NPM Errors when starting node.js - Cpanel Node Js Selector
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 npm@6.14.8
3 info using node@v14.15.1
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle authentication-mern@1.0.0~prestart: authentication-mern@1.0.0
6 info lifecycle authentication-mern@1.0.0~start: authentication-mern@1.0.0
7 verbose lifecycle authentication-mern@1.0.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle authentication-mern@1.0.0~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 authentication-mern@1.0.0~start: CWD: /home/pasindu/app
10 silly lifecycle authentication-mern@1.0.0~start: Args: [ '-c', 'node backend/server/server.js' ]
11 silly lifecycle authentication-mern@1.0.0~start: Returned: code: 1 signal: null
12 info lifecycle authentication-mern@1.0.0~start: Failed to exec start script
13 verbose stack Error: authentication-mern@1.0.0 start: `node backend/server/server.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/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. (/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 authentication-mern@1.0.0
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 authentication-mern@1.0.0 start: `node backend/server/server.js`
22 error Exit status 1
23 error Failed at the authentication-mern@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 don't see any obvious errors but it looks like this is something with your script as per: 10 silly lifecycle authentication-mern@1.0.0~start: Args: [ '-c', 'node backend/server/server.js' ] 11 silly lifecycle authentication-mern@1.0.0~start: Returned: code: 1 signal: null 12 info lifecycle authentication-mern@1.0.0~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? 0 -
I don't see any obvious errors but it looks like this is something with your script as per: 10 silly lifecycle authentication-mern@1.0.0~start: Args: [ '-c', 'node backend/server/server.js' ] 11 silly lifecycle authentication-mern@1.0.0~start: Returned: code: 1 signal: null 12 info lifecycle authentication-mern@1.0.0~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?0 -
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? 0 -
I do agree this issue seems to be within the script itself. Can you check the passenger logs that @andrew.n mentioned? 0 -
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? :) [QUOTE] 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) 0 -
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. 0 -
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.0
Please sign in to leave a comment.
Comments
8 comments