Trouble shoot NPM in NodeJS

412 views Asked by At

When i Executed the below command

npm install request

output is :

bash: npm: command not found
2

There are 2 answers

3
jwchang On

Install npm

through

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

and then run

npm install request
0
Dexter On

For the terminal to install request module :

npm install request

The following is the output

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!     <[email protected]>
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

The contents of the file /home/applmgr/npm-debug.log

info it worked if it ends with ok
verbose cli [ 'node', '/opt/node0610/bin/npm', 'install', 'request' ]
info using [email protected]
info using [email protected]
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!     <[email protected]>
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 ]