• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Resolved node.js not finding script

robetus

Basic Pleskian
I'm testing node.js in Onyx and with a simple hello.js script:

console.log('Hello World');
When I run the script I get the following errors in npm-debug.log (please also see attached for how I'm trying to run the script):

0 info it worked if it ends with ok
1 verbose cli [ '/opt/plesk/node/6/bin/node',
1 verbose cli '/opt/plesk/node/6/bin/npm',
1 verbose cli 'run',
1 verbose cli 'hello.js' ]
2 info using [email protected]
3 info using [email protected]
4 verbose stack Error: missing script: hello.js
4 verbose stack at run (/opt/plesk/node/6/lib/node_modules/npm/lib/run-script.js:151:19)
4 verbose stack at /opt/plesk/node/6/lib/node_modules/npm/lib/run-script.js:61:5
4 verbose stack at /opt/plesk/node/6/lib/node_modules/npm/node_modules/read-package-json/read-json.js:356:5
4 verbose stack at checkBinReferences_ (/opt/plesk/node/6/lib/node_modules/npm/node_modules/read-package-json/read-json.js:320:45)
4 verbose stack at final (/opt/plesk/node/6/lib/node_modules/npm/node_modules/read-package-json/read-json.js:354:3)
4 verbose stack at then (/opt/plesk/node/6/lib/node_modules/npm/node_modules/read-package-json/read-json.js:124:5)
4 verbose stack at /opt/plesk/node/6/lib/node_modules/npm/node_modules/read-package-json/read-json.js:243:12
4 verbose stack at /opt/plesk/node/6/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:78:16
4 verbose stack at tryToString (fs.js:455:3)
4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:442:12)
5 verbose cwd /var/www/vhosts/tester-erin.com/httpdocs
6 error Linux 3.14.32-xxxx-grs-ipv6-64
7 error argv "/opt/plesk/node/6/bin/node" "/opt/plesk/node/6/bin/npm" "run" "hello.js"
8 error node v6.3.1
9 error npm v3.10.3
10 error missing script: hello.js
11 error If you need help, you may report this error at:
11 error <https://github.com/npm/npm/issues>


The Application URL, Application Root, and Application Startup File are all correct and showing no errors. Any help in this would be greatly appreciated. Running on:

OS ‪CentOS 6.8 (Final)‬
Product Plesk Onyx
Version 17.0.17
 

Attachments

  • error.png
    error.png
    118.4 KB · Views: 18
Tooltip for "Run script" is "Run a command specified in the 'Scripts' section of the 'package.json' file."
This button allows you to run scripts registered in your package.json file.

If you want run hello.js file over this functionality you must add the following code into your package.json file:
Code:
  "scripts": {
    "hello": "node hello.js"
  },

You can read https://docs.npmjs.com/misc/scripts for more details.
 
Thank you for your reply. What do you mean by "this" functionality? Is there another way I can run the app or start the app in Onyx?
 
Okay so when I just click Run I get this (I changed the name of the app to server):

Code:
Lifecycle scripts included in node-example:
  start
    node server.js

available via `npm run-script`:
  server
    node server.js

Does this mean it's running?
 
Okay, I got it working. If I define the Application Root location within the app do I need to also change my Document root in the domains Hosting Settings to match the apps Application Root? I guess I could just test it but I wanted to ask for future readers. Being able to run node.js apps within plesk with a GUI is super sweet!
 
Back
Top