[英]npx create-react-app fatal error: JavaScript heap out of memory
嘗試使用 npx create-react-app 評估為反應應用程序創建樣板
D:\React>create-react-app assessment
Creating a new React app in D:\React\assessment.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
[ ........] | reify:color-convert: timing reifyNode:node_modules/jest-validate/node_modules/color-convert Comp
#
# Fatal error in , line 0
# Fatal process out of memory: Zone
#
#
#
#FailureMessage Object: 000000888EBFA4C0[ ........] / reify:color-convert: timing reifyNode:node_modules/jest-s[ ........] / reify:color-convert: timing reifyNode:node_modules/jest-snapshot/node_modules/color-convert Comp
<--- Last few GCs --->
[7756:000001A77FCE9290] 304467 ms: Scavenge 239.7 (274.6) -> 239.1 (274.6) MB, 2.8 / 0.0 ms (average mu = 0.996, current mu = 0.999) allocation failure
[7756:000001A77FCE9290] 306201 ms: Scavenge 239.8 (274.6) -> 239.3 (274.6) MB, 186.4 / 181.9 ms (average mu = 0.996, current mu = 0.999) allocation failure
[7756:000001A77FCE9290] 307086 ms: Scavenge 240.1 (274.6) -> 239.6 (274.6) MB, 3.9 / 0.1 ms (average mu = 0.996, current mu = 0.999) allocation failure
<--- JS stacktrace --->
==== JS stack trace =========================================
0: ExitFrame [pc: 00007FF647760366]
1: StubFrame [pc: 00007FF647761333]
2: StubFrame [pc: 00007FF647732BAD]
Security context: 0x0364ad71a299 <JSObject>
3: replace [00000364AD709699](this=0x03c776effa81 <String[175]\: [\x1b[7m \x1b[27m\x1b[90m........\x1b[0m] / reify:color-convert: \x1b[32;40mtiming\x1b[0m \x1b[35mreifyNode:node_modules/jest-snapshot/node_modules/color-convert\x1b[0m Completed in 194645ms>,0x03b334...
FATAL ERROR: Committing semi space failed. Allocation failed - JavaScript heap out of memory
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting assessment/ from D:\React
上面的痕跡來自 CMD,也嘗試過使用管理員權限,但仍然是同樣的問題。 還嘗試通過npm clean cache --force
清理 NPM 緩存,但問題仍然存在,如果有人可以提供幫助的話!!
使用節點版本 12.2.0 和 npm 版本 7.20.0
這個答案看起來可能是相關的。
不過,如果可能的話,我建議您先將您的 NodeJS 版本升級到最新的 12.x 或最高 14.x。
您還需要確保獲得最新的create-react-app
因為問題可能在於舊版本的NodeJS
與create-react-app
沖突。
在您更新完內容后,我將使用create-react-app
指南中的npx create-react-app assessments
來創建您的應用程序以查看進展情況。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.