Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Node forever doesn't work on Ubuntu 12.04.1

When I fun forever on Ubuntu 12.04.1, I got the error below after upgrading node.js from v0.6.12 to v0.8.15. Before upgrading it works well. Does anyone encounter this kind of issue before?

$ forever

module.js:340
    throw err;
          ^
Error: Cannot find module './daemon.v0.8.15'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:362:17)
    at require (module.js:378:17)
    at Object.<anonymous> (/usr/local/lib/node_modules/forever/node_modules/daemon/lib/daemon.js:12:11)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:362:17)

My environment is

node v0.8.15
npm 1.1.66

I installed node and npm with the command line blow

$ sudo apt-get install python-software-properties -y
$ sudo add-apt-repository ppa:chris-lea/node.js
$ sudo apt-get update
$ sudo apt-get install nodejs npm -y

I installed forever with the command line

$ sudo npm install forever -g
like image 213
Jeffrey Avatar asked Dec 14 '12 05:12

Jeffrey


2 Answers

'sudo npm update -g forever' doesn't work for me. I deleted all the installed modules and install it again. The forever works. The steps are as below.

Delete the all the existing forever modules.

$ sudo rm -R /usr/lib/node_modules/forever
$ sudo rm -R /usr/local/lib/node_modules/forever

Install the forever again.

$ sudo npm install forever -g
like image 168
Jeffrey Avatar answered Oct 21 '22 06:10

Jeffrey


You will get he solution with below commands but some issue, so please try the PM2 with so many advantages and check points of debuting

    $ sudo rm -R /usr/lib/node_modules/forever
    $ sudo rm -R /usr/local/lib/node_modules/forever

Please use this for debuting the node.js exception and monitoring the process of each and every with clustering and master and slave logic

http://devo.ps/blog/2013/06/26/goodbye-node-forever-hello-pm2.html

    $ sudo npm install -g pm2
like image 27
Kalpesh Gamit Avatar answered Oct 21 '22 06:10

Kalpesh Gamit