'RangeError: WebAssembly.instantiate(): Out of memory: wasm memory
I am getting this error while starting my node js app in my cpanel.
RangeError: WebAssembly.instantiate(): Out of memory: wasm memory
at internal/deps/cjs-module-lexer/dist/lexer.js:1:33573
but while i am developing in localhost, everything works just fine.
Here is my output log,
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/opt/alt/alt-nodejs14/root/usr/bin/node',
1 verbose cli '/opt/alt/alt-nodejs14/root/usr/bin/npm',
1 verbose cli 'run-script',
1 verbose cli 'start',
1 verbose cli '--'
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/alt/alt-nodejs14/root/usr/lib/node_modules/npm/node_modules.bundled/npm-lifecycle/node-gyp-bin:/home/proudpos/backend/node_modules/.bin:/opt/alt/alt-nodejs14/root/usr/bin:/home/proudpos/nodevenv/backend/14/bin:/opt/alt/alt-nodejs14/root/usr/bin:/home/proudpos/nodevenv/backend/14/lib/bin/:/usr/local/jdk/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/X11R6/bin:/root/bin:/opt/bin
9 verbose lifecycle [email protected]~start: CWD: /home/proudpos/backend
10 silly lifecycle [email protected]~start: Args: [ '-c', 'node server.js' ]
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: `node server.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/opt/alt/alt-nodejs14/root/usr/lib/node_modules/npm/node_modules.bundled/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:375:28)
13 verbose stack at ChildProcess.<anonymous> (/opt/alt/alt-nodejs14/root/usr/lib/node_modules/npm/node_modules.bundled/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:375:28)
13 verbose stack at maybeClose (internal/child_process.js:1055:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/proudpos/backend
16 verbose Linux 3.10.0-962.3.2.lve1.5.60.el7.x86_64
17 verbose argv "/opt/alt/alt-nodejs14/root/usr/bin/node" "/opt/alt/alt-nodejs14/root/usr/bin/npm" "run-script" "start" "--"
18 verbose node v14.17.3
19 verbose npm v6.14.13
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `node server.js`
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 ]
I searched but could not found any answer. need some help with this.
Solution 1:[1]
I had the same issue, I was running node command in background in a vps, the all over sudden it went down, I went to my cpanel terminal and stopped the job the tried restarting but it gave me that error, I couldn't fix it. I opened my local machine's terminal, accessed the app via ssh, and reuploaded the code then it worked fine. I still do not understand the difference between cpanel terminal and my laptops terminal.
Solution 2:[2]
Just ssh and run npm run dev and it will work.In my case I did not reupload the code.
Solution 3:[3]
I had the same error, and surprisingly i ran the same command npm run dev but from SSH not cPanel, and it is working fine !
Solution 4:[4]
Well,
It turned out I was using type: "module" in my package.json file.
this was the issue that kept blocking cpanel to run my application. It was working fine for me on ssh but not normally via cpanel. my node -v returned v14.18.1
- I changed my code from
importtorequiresyntax. - removed
type: "module"from package.json - refactored my code accordingly
- and it worked normally on cpanel.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Dennis Kiprotich |
| Solution 2 | wanjiku |
| Solution 3 | Adham shafik |
| Solution 4 | Dharman |
