简体   繁体   中英

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

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. Also tried to clean NPM cache by npm clean cache --force but the issue still persist, if anybody can help on the same!!

Using node version 12.2.0 and npm version 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.

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 .

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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