我在amazon-ec2 / digitalocean ubuntu中全局安装了sails.js(v0.9.16)..
sudo npm -g install sails
创建了一个测试项目..
sails new sailstest
然后解除了服务器..它工作正常..
cd sailstest
sails lift
我可以在
上看到sails app主页http://<domain>:1337/
但是当我尝试使用app2中的pm2运行它时,
pm2 start app.js
我收到了以下错误..
Error: Cannot find module 'sails'
at Function.Module._resolveFilename (module.js:331:15)
at Function.Module._load (module.js:273:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object.<anonymous> (/var/www/authenticator/sailstest/app.js:2:1)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (/usr/lib/node_modules/pm2/node_modules/coffee-script/lib/coffee-script/r$
at Function.Module._load (module.js:305:12)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at /usr/lib/node_modules/pm2/lib/ProcessContainer.js:151:5
at WriteStream.<anonymous> (/usr/lib/node_modules/pm2/lib/ProcessContainer.js:104:9)
at WriteStream.EventEmitter.emit (events.js:107:17)
at WriteStream.<anonymous> (fs.js:1668:10)
at Object.oncomplete (fs.js:97:15)
我也尝试过永远使用...
forever start app.js
低于错误..
module.js:333
throw err;
^
Error: Cannot find module 'sails'
at Function.Module._resolveFilename (module.js:331:15)
at Function.Module._load (module.js:273:25)
at Module.require (module.js:357:17)
at require (module.js:373:17)
at Object.<anonymous> (/var/www/authenticator/sailstest/app.js:2:1)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:349:32)
at Function.Module._load (module.js:305:12)
at Function.Module.runMain (module.js:490:10)
error: Forever detected script exited with code: 1
/usr/lib/node_modules/forever/node_modules/forever-monitor/node_modules/broadway/node_modu$
throw arguments[1]; // Unhandled 'error' event
^
Error: Cannot stop process that is not running.
at /usr/lib/node_modules/forever/node_modules/forever-monitor/lib/forever-monitor/moni$
at process._tickCallback (node.js:343:11)
知道出了什么问题吗?
答案 0 :(得分:1)
我已经升级到sails.js的最新版本..现在它的工作正常,永远和pm2 ......
npm -g update sails
现在sailsjs版本0.10.0-rc7可以正常使用&amp; PM2 ..