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.
5
Answers
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.
Just ssh and run npm run dev and it will work.In my case I did not reupload the code.
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 !
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.1import
torequire
syntax.type: "module"
from package.jsonThe important point is that you are using your hosting provider cPanel (shared hosting) or another VPS with a control panel with a built-in SSH terminal.
So when you run an SSH terminal that your hosting provider offers you. Then, thanks to the power of your server, it emulates an SSH connection and thereby limits its ability to execute commands.
When I encountered such an error, I studied the errors in the logs and saw there that I did not have memory leaks, but at the same time I had enough server power, namely memory. And then I came to the conclusion to connect via SSH via Putty (or you can use your windows SSH terminal or a regular terminal on MacOS). Thus, do not waste your server’s memory resource on emulating an SSH terminal.
I solved this problem like this!
First run your Node.js in Development mode (I had version 14.20.1) in cPanel you will be prompted to activate it.
After you connect to the server directly from the SSH terminal (Shell or MacOS, Linux), execute the NODE.JS activation command that cPanel gave you
It is important to run this command in a terminal so that you can run "NPM" commands
Then
and ready to check your site;
To get the result on a permanent basis, you need to build
to do this, put your NODE.JS in production mode and run the following commands in the terminal