Npm start throws error. Project was created with npx create-react-app
FATAL ERROR: WasmCodeManager::Commit: Cannot make pre-reserved region writable Allocation failed - process out of memory
Error log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/opt/homebrew/Cellar/node/15.2.1/bin/node',
1 verbose cli '/opt/homebrew/bin/npm',
1 verbose cli 'start'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 info lifecycle [email protected]~start: [email protected]
7 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
8 verbose lifecycle [email protected]~start: PATH: /opt/homebrew/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/audrius/code/react/fullstackopen/exercises/test/node_modules/.bin:/opt/homebr$
9 verbose lifecycle [email protected]~start: CWD: /Users/audrius/code/react/fullstackopen/exercises/test
10 silly lifecycle [email protected]~start: Args: [ '-c', 'react-scripts start' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: react-scripts start
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.
13 verbose stack at EventEmitter.emit (node:events:329:20)
13 verbose stack at ChildProcess.
13 verbose stack at ChildProcess.emit (node:events:329:20)
13 verbose stack at maybeClose (node:internal/child_process:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (node:internal/child_process:288:5)
14 verbose pkgid [email protected]
15 verbose cwd /Users/audrius/code/react/fullstackopen/exercises/test
16 verbose Darwin 20.1.0
17 verbose argv "/opt/homebrew/Cellar/node/15.2.1/bin/node" "/opt/homebrew/bin/npm" "start"
18 verbose node v15.2.1
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: react-scripts start
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
My system:
System:
OS: macOS 11.0.1
CPU: (8) arm64 Apple processor
Binaries:
Node: 15.2.1 - /opt/homebrew/bin/node
Yarn: Not Found
npm: 6.14.8 - /opt/homebrew/bin/npm
Browsers:
Chrome: Not Found
Edge: Not Found
Firefox: Not Found
Safari: 14.0.1
npmPackages:
react: ^17.0.1 => 17.0.1
react-dom: ^17.0.1 => 17.0.1
react-scripts: 4.0.0 => 4.0.0
npmGlobalPackages:
create-react-app: Not Found
Yep, getting this too, but only during build
Somehow this is caused by react-refresh-webpack-plugin. If I disable it, the app works as expected for me env FAST_REFRESH=false npm start
Is this on Apple silicon?
Hi - as far as I understand this error is only happening on Apple Silicon M1 based devices.
Somehow this is caused by
react-refresh-webpack-plugin. If I disable it, the app works as expected for meenv FAST_REFRESH=false npm start
This mostly is not use but rather upstream - some packages in the HMR hot path (like source-map (source map generation) and chokidar (file watching)) depends on WASM or native capabilities, which with Node.js not even having proper support for the platform, is bound to fail.
You could try to lower the actual amount of memory Node.js would try to allocate to potentially evade the issue (ref: pmmmwh/react-refresh-webpack-plugin#259)
@pmmmwh is correct - the issue is way upstream from CRA or react-refresh, and it has been fixed in Node at https://github.com/nodejs/node/commit/c1442ec9c45cecf156fb32ad2174c4aceef37de7 (I confirmed by compiling from that commit and it works as expected). That commit is not yet included in any released versions, but Node folks are hard at making a stable Apple Silicon version for us, so we'll just wait.
Great that the fix is coming. And I confirm that it works with env FAST_REFRESH=false npm start
@pmmmwh is correct - the issue is way upstream from CRA or react-refresh, and it has been fixed in Node at nodejs/node@c1442ec (...)
This has been released today in Node 15.3.0. Can confirm that the error has disappeared for me after the update.
Most helpful comment
Hi - as far as I understand this error is only happening on Apple Silicon M1 based devices.
This mostly is not use but rather upstream - some packages in the HMR hot path (like
source-map(source map generation) andchokidar(file watching)) depends on WASM or native capabilities, which with Node.js not even having proper support for the platform, is bound to fail.You could try to lower the actual amount of memory Node.js would try to allocate to potentially evade the issue (ref: pmmmwh/react-refresh-webpack-plugin#259)