简体   繁体   中英

Start server node.js with forever on ubuntu

I been searching alot and no result with same problem as me. I have a Node.js application and I want to start it with forever start app.js , the process starts but no website found when i try in browser. The process is in the list when I write forever list .

Npm start works fine but I cant use nodejs/node app.js or my_file.js.. It gives no error or something just new command line with no output in terminal.

So anyone know why I cant start the app with nodejs app.js or forever start app.js .. No files works.

Thanks!

In express 4 you should write :

forever ./bin/www

And if you check your package.json file you can see :

"scripts": {
    "start": "node ./bin/www"
  }

It's the npm start script

Alternatively, you can try using PM2 .

It does a great job at keeping your app alive, and has some really useful features such as load balancing, no downtime, and a web interface to monitor your processes.

In addition, I find it dead simple to use.

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