我刚刚安装了node和npm但是当我尝试永远安装sudo npm install forever -g或sudo npm install -g forever我收到错误日志文件中报告的错误。
verbose cli [ 'node', '/usr/local/bin/npm', 'install', 'forever', '-g' ]
info using npm@1.1.0-2
info using node@v0.6.8
verbose config file /root/.npmrc
verbose config file /usr/local/etc/npmrc
verbose config file /usr/local/lib/node_modules/npm/npmrc
silly exec /usr/local/bin/node "/usr/local/lib/node_modules/npm/bin/npm-get-uid-gid.js" "nobody" 0
silly spawning [ '/usr/local/bin/node',
silly spawning [ '/usr/local/lib/node_modules/npm/bin/npm-get-uid-gid.js',
silly spawning 'nobody',
silly spawning 0 ],
silly spawning null ]
silly output from getuid/gid {"uid":99,"gid":0}
silly output from getuid/gid
verbose cache add [ 'forever', null ]
silly cache add: name, spec, args [ undefined, 'forever', [ 'forever', null ] ]
verbose parsed url { pathname: 'forever', path: 'forever', href: 'forever' }
verbose addNamed [ 'forever', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'forever', '', false ]
verbose raw, before any munging forever
verbose url resolving [ 'https://registry.npmjs.org/', './forever' ]
verbose url resolved https://registry.npmjs.org/forever
http GET https://registry.npmjs.org/forever
ERR! Error: failed to fetch from registry: forever
ERR! at /usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:139:12
ERR! at cb (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:32:9)
ERR! at Request._callback (/usr/local/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:137:18)
ERR! at Request.callback (/usr/local/lib/node_modules/npm/node_modules/request/main.js:109:22)
ERR! at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:198:58)
ERR! at Request.emit (events.js:88:20)
ERR! at ClientRequest.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/request/main.js:356:14)
ERR! at ClientRequest.emit (events.js:67:17)
ERR! at HTTPParser.onIncoming (http.js:1238:11)
ERR! at HTTPParser.onHeadersComplete (http.js:102:31)
ERR! You may report this log at:
ERR! <http://github.com/isaacs/npm/issues>
答案 0 :(得分:1)
当前版本的Node是6.6(写作时)。您的日志表明您使用的是0.6.8版。尝试安装较新版本的Node。