简体   繁体   中英

forever start app.js on digital ocean does not work

I want to permanently run my node server on Digital Ocean, so I installed forever with npm install forever. That seemed to work, but when I type 'forever start app.js', I get an error message that says:

/usr/bin/env: node: No such file or directory

If I run the same commands on my local desktop, everything works fine. Any ideas?

Found the reason. Because of a conflict with another package, the executable from the Ubuntu repositories is called 'nodejs' instead of 'node' on the Digital Ocean server. Then when you try to use forever, it tries to look for the 'node" command which doesn't work.

Solution: Add a symlink to direct the 'node' command to 'nodejs'

sudo ln -s "$(which nodejs)" /usr/bin/node

I tried that and everything works fine from there. Reference: https://www.digitalocean.com/community/questions/ubuntu-repo-nodejs-require-symlink-to-node-to-use-forever

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM