RangeError: WebAssembly.instantiate(): Out of memory: wasm memory - node.js

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 npm#6.14.13
3 info using node#v14.17.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle thewebapp#1.0.0~prestart: thewebapp#1.0.0
6 info lifecycle thewebapp#1.0.0~start: thewebapp#1.0.0
7 verbose lifecycle thewebapp#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle thewebapp#1.0.0~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 thewebapp#1.0.0~start: CWD: /home/proudpos/backend
10 silly lifecycle thewebapp#1.0.0~start: Args: [ '-c', 'node server.js' ]
11 silly lifecycle thewebapp#1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle thewebapp#1.0.0~start: Failed to exec start script
13 verbose stack Error: thewebapp#1.0.0 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 thewebapp#1.0.0
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 thewebapp#1.0.0 start: `node server.js`
22 error Exit status 1
23 error Failed at the thewebapp#1.0.0 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.

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.1
I changed my code from import to require syntax.
removed type: "module" from package.json
refactored my code accordingly
and it worked normally on cpanel.

Related

Unable to start twilio project

I have a twilio flex plugin project. I normally start the project with npm start which is aliased to UNBUNDLED_REACT=true twilio flex:plugins:start within my package.json file. However, today when I run npm start, I'm getting the following error:
» Could not get credentials for profile "my_email#my_work.com".
» To reconfigure the profile, run: twilio profiles:create`
Also logged to the console is a message that gives me a path to a log file. Within that log file I see the following content:
`0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/usr/local/Cellar/node/14.11.0/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.14.8
3 info using node#v14.11.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle twilio-flex-agent-dashboard#0.0.2~prestart: twilio-flex-agent-dashboard#0.0.2
6 info lifecycle twilio-flex-agent-dashboard#0.0.2~start: twilio-flex-agent-dashboard#0.0.2
7 verbose lifecycle twilio-flex-agent-dashboard#0.0.2~start: unsafe-perm in lifecycle true
8 verbose lifecycle twilio-flex-agent-dashboard#0.0.2~start: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/my_user/Desktop/twilio-flex-agent-dashboard/node_modules/.bin:/Users/my_user/kafka-stuff/bin:/usr/local/opt/postgresql#9.6/bin:/bin:/usr/bin:/usr/local/bin:/usr/sbin
9 verbose lifecycle twilio-flex-agent-dashboard#0.0.2~start: CWD: /Users/my_user/Desktop/twilio-flex-agent-dashboard
10 silly lifecycle twilio-flex-agent-dashboard#0.0.2~start: Args: [ '-c', 'UNBUNDLED_REACT=true twilio flex:plugins:start' ]
11 silly lifecycle twilio-flex-agent-dashboard#0.0.2~start: Returned: code: 1 signal: null
12 info lifecycle twilio-flex-agent-dashboard#0.0.2~start: Failed to exec start script
13 verbose stack Error: twilio-flex-agent-dashboard#0.0.2 start: `UNBUNDLED_REACT=true twilio flex:plugins:start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:314:20)
13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:314:20)
13 verbose stack at maybeClose (internal/child_process.js:1047:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid twilio-flex-agent-dashboard#0.0.2
15 verbose cwd /Users/my_user/Desktop/twilio-flex-agent-dashboard
16 verbose Darwin 20.5.0
17 verbose argv "/usr/local/Cellar/node/14.11.0/bin/node" "/usr/local/bin/npm" "start"
18 verbose node v14.11.0
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error twilio-flex-agent-dashboard#0.0.2 start: `UNBUNDLED_REACT=true twilio flex:plugins:start`
22 error Exit status 1
23 error Failed at the twilio-flex-agent-dashboard#0.0.2 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
When I do what the original error message is suggesting (ie running twilio profiles:create, I get a success message. However, I'm still unable to start the project.
So my question is, what has happened to my system where now I'm getting this error, and how do I fix it so I can start my project with npm start like I was doing previously?
Alright, issue has been resolved, My issue was that I was entering what I thought was the correct username when I ran twilio profiles:create, but really in fact, was the wrong username. Entering the correct username has resolved this issue.

Plesk npm 12 installed, but showing 6.9.0

I have installed Node.js from upgrade/install packages without any problems, but when I try to run the following: /opt/plesk/node/12/bin/node -v the output i get is:
12.4.0
The problem is that when I try to install authentication with Bootstrap for Laravel, and I get to the point where I need to run: npm install && npm run dev I get the following error when running /opt/plesk/node/12/bin/npm run dev:
Error: You are using an unspported version of Node. Please update to
at least Node v12.14
It seems like I a'm running the newest version, but it still complaints about wrong version number? - How to fix?
UPDATE (debug log):
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/opt/plesk/node/12/bin/node',
1 verbose cli '/opt/plesk/node/12/bin/npm',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm#6.9.0
3 info using node#v12.4.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle #~predev: #
6 info lifecycle #~dev: #
7 verbose lifecycle #~dev: unsafe-perm in lifecycle true
8 verbose lifecycle #~dev: PATH: /opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/vhosts/domain.com/httpdocs2/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/us$
9 verbose lifecycle #~dev: CWD: /var/www/vhosts/domain.com/httpdocs2
10 silly lifecycle #~dev: Args: [ '-c', 'npm run development' ]
11 silly lifecycle #~dev: Returned: code: 1 signal: null
12 info lifecycle #~dev: Failed to exec dev script
13 verbose stack Error: # dev: `npm run development`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:200:13)
13 verbose stack at ChildProcess.<anonymous> (/opt/plesk/node/12/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:200:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid #
15 verbose cwd /var/www/vhosts/domain.com/httpdocs2
16 verbose Linux 4.15.0-126-generic
17 verbose argv "/opt/plesk/node/12/bin/node" "/opt/plesk/node/12/bin/npm" "run" "dev"
18 verbose node v12.4.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error # dev: `npm run development`
22 error Exit status 1
23 error Failed at the # dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
A big thanks to NullDev for leading me in the right direction!
I found the answer here: How to add a new node.js version for the Node.js Manager on Plesk?
We need to install Node Version Manager
Then install whatever version we want (I wanted the newest one v14.15.4)
We then copy that version to Plesk default Node versions path
And finally we tell Plesk about the newly version created
Then in the list of all versions installed, we refresh and voila, we now have support for v14.15.4
Credit for this goes to Maertz

sh: 1: rimraf: Permission denied issue on live server

Thanks for looking at my issue.
Basically I am facing problem with making build on production dedicated server.
I have executed "npm run build" command and I have received the
the issue
sh: 1: rimraf: Permission denied issue on live server
I am not sure how exactly we should solve it.
My error logs are as follow below.
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'build' ]
2 info using npm#6.10.2
3 info using node#v9.11.2
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle #~prebuild: #
6 info lifecycle #~build: #
7 verbose lifecycle #~build: unsafe-perm in lifecycle true
8 verbose lifecycle #~build: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/var/www/html/basepath/moneytransfer/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
9 verbose lifecycle #~build: CWD: /var/www/html/basepath/moneytransfer
10 silly lifecycle #~build: Args: [ '-c',
10 silly lifecycle 'npm run clean && webpack --mode development --progress' ]
11 silly lifecycle #~build: Returned: code: 126 signal: null
12 info lifecycle #~build: Failed to exec build script
13 verbose stack Error: # build: `npm run clean && webpack --mode development --progress`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:326:16)
13 verbose stack at EventEmitter.emit (events.js:180:13)
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:180:13)
13 verbose stack at maybeClose (internal/child_process.js:936:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
14 verbose pkgid #
15 verbose cwd /var/www/html/basepath/moneytransfer
16 verbose Linux 4.15.0-29-generic
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "build"
18 verbose node v9.11.2
19 verbose npm v6.10.2
20 error code ELIFECYCLE
21 error errno 126
22 error # build: `npm run clean && webpack --mode development --progress`
22 error Exit status 126
23 error Failed at the # build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
npm i rimraf
worked for me because I was not in wifi environment. I had a similar error trace (after porting a project with node_modules from windows to mac)
I tried so many solution but nothing worked.But finally removed node_modules folder and executed "npm install" which means re-installation of node modules.And Everything seems working fine now.
Deleting the node_modules folder seemed to do the trick whenever I was running into such problems!
It is probably caused by different rules related to different file systems; e.g. just different systems or even different operating systems.

Build nodejs Fail with exit status 126 - Permission denied

I faced a issue when I do a npm start in my linux server.
It is showing error with exit code 126 and permission denied.
I have already done chmod 777 to server.js or rather to the whole folder of demoTest.
How do I fixed this?
The log is shown as below.
info it worked if it ends with ok
1 verbose cli [ '/opt/node-v8.11.3-linux-x64/bin/node', '/bin/npm', 'start' ]
2 info using npm#5.6.0
3 info using node#v8.11.3
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle demoTest#1.0.0~prestart: demoTest#1.0.0
6 info lifecycle demoTest#1.0.0~start: demoTest#1.0.0
7 verbose lifecycle demoTest#1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle demoTest#1.0.0~start: PATH: /opt/node-v8.11.3-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/useradmin/demoTest/node_modules/.bin:/sbin:/bin:/usr/sbin:/usr/bin
9 verbose lifecycle demoTest#1.0.0~start: CWD: /home/useradmin/demoTest
10 silly lifecycle demoTest#1.0.0~start: Args: [ '-c', 'nodemon ./rest/server.js' ]
11 silly lifecycle demoTest#1.0.0~start: Returned: code: 126 signal: null
12 info lifecycle demoTest#1.0.0~start: Failed to exec start script
13 verbose stack Error: demoTest#1.0.0 start: `nodemon ./rest/server.js`
13 verbose stack Exit status 126
13 verbose stack at EventEmitter.<anonymous> (/opt/node-v8.11.3-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/opt/node-v8.11.3-linux-x64/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid demoTest#1.0.0
15 verbose cwd /home/useradmin/demoTest/rest
16 verbose Linux 3.10.0-862.el7.x86_64
17 verbose argv "/opt/node-v8.11.3-linux-x64/bin/node" "/bin/npm" "start"
18 verbose node v8.11.3
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 126
22 error demoTest#1.0.0 start: `nodemon ./rest/server.js`
22 error Exit status 126
23 error Failed at the demoTest#1.0.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 126, true ]
I was getting this same issue when running a Nodejs server and Reactjs client. This process worked for me and should be done in the affected directory (I think that's demoTest for you):
Delete node_modules
Run npm install to reinstall the dependencies in that directory's package.json
I believe this problem started when I copied node_modules from my host to my Ubuntu server rather than running the installs directly from the server CLI.
I am using nodemon and intellij was complaining with "app/server.js: Permission denied, errno 126" until I added the following to my config in package.json.
"scripts": {
"start": "nodemon app/server.js"
}

npm start is throwing unknown error related to lite server

I was working on Angular2 3-4 weeks ago and kept the project as is, on cloud. The problem is now the project won't run, throws this error at start.
I think the issue is with lite-server, but I did update node modules and npm. Is this the issue with my code or the npm?
0 info it worked if it ends with ok
1 verbose cli [ '/home/ubuntu/.nvm/versions/node/v4.6.1/bin/node',
1 verbose cli '/home/ubuntu/.nvm/versions/node/v4.6.1/bin/npm',
1 verbose cli 'start' ]
2 info using npm#4.3.0
3 info using node#v4.6.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle angular2_try#0.0.1~prestart: angular2_try#0.0.1
6 silly lifecycle angular2_try#0.0.1~prestart: no script for prestart, continuing
7 info lifecycle angular2_try#0.0.1~start: angular2_try#0.0.1
8 verbose lifecycle angular2_try#0.0.1~start: unsafe-perm in lifecycle true
9 verbose lifecycle angular2_try#0.0.1~start: PATH: /home/ubuntu/.nvm/versions/node/v4.6.1/lib/node_modules/npm/bin/node-gyp-bin:/home/ubuntu/workspace/node_modules/.bin:/home/ubuntu/.nvm/versions/node/v4.6.1/bin:/usr/local/rvm/gems/ruby-2.3.0/bin:/usr/local/rvm/gems/ruby-2.3.0#global/bin:/usr/local/rvm/rubies/ruby-2.3.0/bin:/mnt/shared/bin:/home/ubuntu/workspace/node_modules/.bin:/home/ubuntu/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/mnt/shared/sbin:/opt/gitl:/opt/go/bin:/mnt/shared/c9/app.nw/bin:/usr/local/rvm/bin
10 verbose lifecycle angular2_try#0.0.1~start: CWD: /home/ubuntu/workspace
11 silly lifecycle angular2_try#0.0.1~start: Args: [ '-c', 'npm run lite' ]
12 silly lifecycle angular2_try#0.0.1~start: Returned: code: 1 signal: null
13 info lifecycle angular2_try#0.0.1~start: Failed to exec start script
14 verbose stack Error: angular2_try#0.0.1 start: `npm run lite`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/home/ubuntu/.nvm/versions/node/v4.6.1/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at EventEmitter.emit (events.js:172:7)
14 verbose stack at ChildProcess.<anonymous> (/home/ubuntu/.nvm/versions/node/v4.6.1/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at ChildProcess.emit (events.js:172:7)
14 verbose stack at maybeClose (internal/child_process.js:829:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid angular2_try#0.0.1
16 verbose cwd /home/ubuntu/workspace
17 error Linux 4.8.8-c9
18 error argv "/home/ubuntu/.nvm/versions/node/v4.6.1/bin/node" "/home/ubuntu/.nvm/versions/node/v4.6.1/bin/npm" "start"
19 error node v4.6.1
20 error npm v4.3.0
21 error code ELIFECYCLE
22 error errno 1
23 error angular2_try#0.0.1 start: `npm run lite`
23 error Exit status 1
24 error Failed at the angular2_try#0.0.1 start script 'npm run lite'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the angular2_try package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error npm run lite
24 error You can get information on how to open an issue for this project with:
24 error npm bugs angular2_try
24 error Or if that isn't available, you can get their info via:
24 error npm owner ls angular2_try
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]
The issue was with port of lite-server settings.
Few weeks back, I was running the app on default lite-server port, 3000. But I changed that to http port, 80. and I forgot that.
Now all I had to do was sudo npm start

Resources