#安装node
apt-get install nodejs
# 安装npm
apt-get updateapt-get install npm
# 安装forever
此时安装forever失败
npm ERR! Error: failed to fetch from registry:
执行:
npm config set registry http://registry.npmjs.org安装forever仍然失败。提示:
/usr/local/lib/node_modules/forever/node_modules/microtime/wscript:9: error: could not configure a cxx compiler!
于是安装g++:
apt-get install g++
#最后安装forever:
npm install forever –g
#启动node程序
进入node所在目录,然后执行(以server.js为例):
forever start server.js
时间: 2024-11-03 07:46:59