简体   繁体   English

npx create-react-app 致命错误:JavaScript 堆内存不足

[英]npx create-react-app fatal error: JavaScript heap out of memory

Tried creating a boiler plate for react app using npx create-react-app assessment尝试使用 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

Above traces are from CMD also tried with Admin rights, but still same issue.上面的痕迹来自 CMD,也尝试过使用管理员权限,但仍然是同样的问题。 Also tried to clean NPM cache by npm clean cache --force but the issue still persist, if anybody can help on the same!!还尝试通过npm clean cache --force清理 NPM 缓存,但问题仍然存在,如果有人可以提供帮助的话!!

Using node version 12.2.0 and npm version 7.20.0使用节点版本 12.2.0 和 npm 版本 7.20.0

This answer looks like it might be related. 这个答案看起来可能是相关的。

Although, I'd suggest upgrading your version of NodeJS to the latest of 12.x or up to 14.x if possible first.不过,如果可能的话,我建议您先将您的 NodeJS 版本升级到最新的 12.x 或最高 14.x。

You'll also want to make sure you're getting the latest create-react-app as the issue could be with an older version of NodeJS conflicting with create-react-app .您还需要确保获得最新的create-react-app因为问题可能在于旧版本的NodeJScreate-react-app冲突。

After you've updated things, I'd use npx create-react-app assessments from the create-react-app guide to create your app to see how things go.在您更新完内容后,我将使用create-react-app指南中的npx create-react-app assessments来创建您的应用程序以查看进展情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM