麻烦在NodeJS中拍摄NPM

时间:2012-07-29 09:47:25

标签: linux node.js 64-bit npm oracle-enterprise-linux

当我执行以下命令时

npm install request

输出是:

bash: npm: command not found

2 个答案:

答案 0 :(得分:1)

安装npm

通过

sudo curl http://npmjs.org/install.sh | sh

然后运行

npm install request

答案 1 :(得分:0)

终端安装请求模块:

npm install request

以下是输出

npm http GET https://registry.npmjs.org/request
npm ERR! Error: failed to fetch from registry: request
npm ERR!     at /opt/node0610/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/opt/node0610/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:32:9)
npm ERR!     at Request._callback (/opt/node0610/lib/node_modules/npm/lib/utils /npm-registry-client/request.js:137:18)
npm ERR!     at Request.callback (/opt/node0610/lib/node_modules/npm/node_modules/request/main.js:109:22)
npm ERR!     at Request.<anonymous> (/opt/node0610/lib/node_modules/npm/node_modules/request/main.js:198:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest.<anonymous> (/opt/node0610/lib/node_modules/npm/node_modules/request/main.js:195:10)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at CleartextStream.<anonymous> (http.js:1134:11)
npm ERR!     at CleartextStream.emit (events.js:67:17)
npm ERR! You may report this log at:
npm ERR!     <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR!     <npm-@googlegroups.com>
npm ERR! 
npm ERR! System Linux 2.6.18-194.el5
npm ERR! command "node" "/opt/node0610/bin/npm" "install" "request"
npm ERR! cwd /home/applmgr
npm ERR! node -v v0.6.10
npm ERR! npm -v 1.1.0-3
npm ERR! message failed to fetch from registry: request
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/applmgr/npm-debug.log
npm not ok

文件/home/applmgr/npm-debug.log

的内容
info it worked if it ends with ok
verbose cli [ 'node', '/opt/node0610/bin/npm', 'install', 'request' ]
info using npm@1.1.0-3
info using node@v0.6.10
verbose config file /home/applmgr/.npmrc
verbose config file /opt/node0610/etc/npmrc
verbose config file /opt/node0610/lib/node_modules/npm/npmrc
verbose cache add [ 'request', null ]
silly cache add: name, spec, args [ undefined, 'request', [ 'request', null ] ]
verbose parsed url { pathname: 'request', path: 'request', href: 'request' }
verbose addNamed [ 'request', '' ]
verbose addNamed [ null, '' ]
silly name, range, hasData [ 'request', '', false ]
verbose raw, before any munging request
verbose url resolving [ 'https://registry.npmjs.org/', './request' ]
verbose url resolved https://registry.npmjs.org/request
http GET https://registry.npmjs.org/request
ERR! Error: failed to fetch from registry: request
ERR!     at /opt/node0610/lib/node_modules/npm/lib/utils/npm-registry-client/get.js:139:12
ERR!     at cb (/opt/node0610/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:32:9)
ERR!     at Request._callback (/opt/node0610/lib/node_modules/npm/lib/utils/npm-registry-client/request.js:137:18)
ERR!     at Request.callback (/opt/node0610/lib/node_modules/npm/node_modules/request/main.js:109:22)
ERR!     at Request.<anonymous> (/opt/node0610/lib/node_modules/npm/node_modules/request/main.js:198:58)
ERR!     at Request.emit (events.js:88:20)
ERR!     at ClientRequest.<anonymous> (/opt/node0610/lib/node_modules/npm/node_modules/request/main.js:195:10)
ERR!     at ClientRequest.emit (events.js:67:17)
ERR!     at CleartextStream.<anonymous> (http.js:1134:11)
ERR!     at CleartextStream.emit (events.js:67:17)
ERR! You may report this log at:
ERR!     <http://github.com/isaacs/npm/issues>
ERR! or email it to:
ERR!     <npm-@googlegroups.com>
ERR! 
ERR! System Linux 2.6.18-194.el5
ERR! command "node" "/opt/node0610/bin/npm" "install" "request"
ERR! cwd /home/applmgr
ERR! node -v v0.6.10
ERR! npm -v 1.1.0-3
ERR! message failed to fetch from registry: request
verbose exit [ 1, true ]