NPM Errors when starting node.js - Cpanel Node Js Selector

Operating System & Version
Cent OS 7 with CLOUDLINUX 7.9
cPanel & WHM Version
v92.0.9

yohanecs

Member
Feb 10, 2021
7
0
1
Sri Lanka
cPanel Access Level
Root Administrator
I have installed Cloud Linux Node JS Selector in Cpanel. Tested it with the default configs and It worked fine. Then I uploaded node.js files which were worked fine in localhost. After uploading the files, I cannot run Js Script, getting errors in npm. below is the log file,

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/pasindu/app/node_modules/.bin:/opt/alt/alt-nodejs14/root/usr/bin:/home/pasindu/nodevenv/app/14/bin:/opt/alt/alt-nodejs14/root/usr/bin:/home/pasindu/nodevenv/app/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/pasindu/app
10 silly lifecycle [email protected]~start: Args: [ '-c', 'node backend/server/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 backend/server/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:315:20)
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:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/pasindu/app
16 verbose Linux 3.10.0-962.3.2.lve1.5.42.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.15.1
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start: `node backend/server/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 ]```
 
Last edited by a moderator:

andrew.n

Well-Known Member
Jun 9, 2020
519
138
43
EU
cPanel Access Level
Root Administrator
I don't see any obvious errors but it looks like this is something with your script as per:

10 silly lifecycle [email protected]~start: Args: [ '-c', 'node backend/server/server.js' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script

Have you installed the dependencies?
Do you use the same node.js version than on your localhost?
How about the npm version?
 
  • Like
Reactions: yohanecs

yohanecs

Member
Feb 10, 2021
7
0
1
Sri Lanka
cPanel Access Level
Root Administrator
I don't see any obvious errors but it looks like this is something with your script as per:

10 silly lifecycle [email protected]~start: Args: [ '-c', 'node backend/server/server.js' ]
11 silly lifecycle [email protected]~start: Returned: code: 1 signal: null
12 info lifecycle [email protected]~start: Failed to exec start script

Have you installed the dependencies?
Do you use the same node.js version than on your localhost?
How about the npm version?
Thanks for the reply @andrew.n

Yes, I have installed dependencies and I'm using the same node.js version and npm version as on my localhost, below is the package.json file contents,


{
"name": "authentication-mern",
"version": "1.0.0",
"description": "Simple Mern App with authentication",
"main": "server.js",
"type": "module",
"scripts": {
"start": "node backend/server/server.js",
"server": "nodemon backend/server/server.js",
"frontend": "npm start --prefix public_html/mern",
"dev": "concurrently \"npm run server\" \"npm run frontend\""
},
"author": "",
"license": "ISC",
"dependencies": {
"bcryptjs": "^2.4.3",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"express-async-handler": "^1.1.4",
"mongoose": "^5.11.15",
"nodemailer": "^6.4.17"
},
"devDependencies": {
"concurrently": "^5.3.0"
}
}


Also, this is a mern stack project... Is cpanel doesn't support that?
 

andrew.n

Well-Known Member
Jun 9, 2020
519
138
43
EU
cPanel Access Level
Root Administrator
cPanel doesn't restrict the type of js you can run but you need to do some debugging to figure out what's going on because right now this is something with the script. The phusion passenger usually logs the errors to /usr/local/apache/logs/error_log though in case of CL this can be different. Have you checked that log?
 
  • Like
Reactions: yohanecs

yohanecs

Member
Feb 10, 2021
7
0
1
Sri Lanka
cPanel Access Level
Root Administrator
Thanks for the reply @andrew.n

Yes, I checked the error log in /usr/local/apache/logs/error_log. Couldn't understand the error. Can you please check the below error log? :)

App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_exec_wrapper/end_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.363)
App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_wrapper_preparation/begin_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.366)
App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_wrapper_preparation/begin_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.388)
App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_wrapper_preparation/end_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.388)
App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_app_load_or_exec/begin_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.388)
App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_app_load_or_exec/begin_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.389)
App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_app_load_or_exec/end_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.389)
App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_listen/begin_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.39)
App 28066 output: (node:28066) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
App 28066 output: (Use `node --trace-warnings ...` to show where the warning was created)
App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_listen/begin_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.394)
App 28066 output: Warning: unable to write to /var/passenger/passenger.spawn.XXXXMd24GR/response/steps/subprocess_listen/end_time: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received type number (1612979057.394)
 

andrew.n

Well-Known Member
Jun 9, 2020
519
138
43
EU
cPanel Access Level
Root Administrator
What are the permissions of the js scripts and folders? They should be owned by the same user under which the script resides at least this is the case when you use it without CL.
 
  • Like
Reactions: yohanecs

yohanecs

Member
Feb 10, 2021
7
0
1
Sri Lanka
cPanel Access Level
Root Administrator
What are the permissions of the js scripts and folders? They should be owned by the same user under which the script resides at least this is the case when you use it without CL.
Thanks for the reply @andrew.n

js scripts and folder permissions are 755. And I'm using cloud linux. Used cloud linux "Setup Node JS App" in Cpanel. I can give you the Cpanel login if needed or should open a ticket on Cpanel Support? I tried t debug this whole day and couldn't resolve it yet.
 

andrew.n

Well-Known Member
Jun 9, 2020
519
138
43
EU
cPanel Access Level
Root Administrator
You can Submit a Ticket at cPanel or maybe you better reaching out to CloudLinux support instead as they are the one providing Node JS management though this seems to be out of the scope of either companies support but they usually do their best to get things resolved. If no luck you can always hire a cPanel certified professional from System Administration Services to help you troubleshoot this further for you.
 
  • Like
Reactions: cPRex