Npm ошибка при установке пакетов

I’m trying to install some node packages through npm, but it won’t go.
I’ve already tried to install/unistall/update node, but nothing seems to work.

I’m using ubuntu 12.04 — Here is how i’m trying to install packages:

npm install underscore

npm http GET http://registry.npmjs.org/underscore
npm http 404 http://registry.npmjs.org/underscore
npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token <
npm ERR! <html>
npm ERR!   <head>
npm ERR!     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
npm ERR!     <script type="text/javascript" language="JavaScript" src="http://img.sedoparking.com/registrar/dopark.js"></script>
npm ERR!   </head>
npm ERR!   <body style="display: none;">
npm ERR!     <script type="text/javascript">
npm ERR! var reg = 'sedonewreg';
npm ERR! document.write( '<scr'+'ipt type="text/javascript" language="JavaScript"' + 'src="http://sedoparking.com/' + window.location.host + '/' + reg + '/park.js">' + '<\/scr' + 'ipt>' );
npm ERR!     </script>
npm ERR!  </body>
npm ERR! </html>
npm ERR! 
npm ERR!     at Object.parse (native)
npm ERR!     at RegClient.<anonymous> (/home/smanastirliu/local/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:235:23)
npm ERR!     at Request.self.callback (/home/smanastirliu/local/lib/node_modules/npm/node_modules/request/index.js:142:22)
npm ERR!     at Request.EventEmitter.emit (events.js:98:17)
npm ERR!     at Request.<anonymous> (/home/smanastirliu/local/lib/node_modules/npm/node_modules/request/index.js:856:14)
npm ERR!     at Request.EventEmitter.emit (events.js:117:20)
npm ERR!     at IncomingMessage.<anonymous> (/home/smanastirliu/local/lib/node_modules/npm/node_modules/request/index.js:808:12)
npm ERR!     at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR!     at _stream_readable.js:895:16
npm ERR!     at process._tickCallback (node.js:415:13)
npm ERR! If you need help, 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! System Linux 3.5.0-27-generic
npm ERR! command "/home/smanastirliu/local/bin/node" "/home/smanastirliu/local/bin/npm" "install" "underscore"
npm ERR! cwd /home/smanastirliu
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! type unexpected_token
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR!  { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path: 'npm-debug.log' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.5.0-27-generic
npm ERR! command "/home/smanastirliu/local/bin/node" "/home/smanastirliu/local/bin/npm" "install" "underscore"
npm ERR! cwd /home/smanastirliu
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/smanastirliu/npm-debug.log
npm ERR! not ok code 0
smanastirliu@sviluppo69:~$ sudo npm install underscore
[sudo] password for smanastirliu: 
npm http GET http://registry.npmjs.org/underscore
npm http 404 http://registry.npmjs.org/underscore
npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token <
npm ERR! <html>
npm ERR!   <head>
npm ERR!     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
npm ERR!     <script type="text/javascript" language="JavaScript" src="http://img.sedoparking.com/registrar/dopark.js"></script>
npm ERR!   </head>
npm ERR!   <body style="display: none;">
npm ERR!     <script type="text/javascript">
npm ERR! var reg = 'sedonewreg';
npm ERR! document.write( '<scr'+'ipt type="text/javascript" language="JavaScript"' + 'src="http://sedoparking.com/' + window.location.host + '/' + reg + '/park.js">' + '<\/scr' + 'ipt>' );
npm ERR!     </script>
npm ERR!  </body>
npm ERR! </html>
npm ERR! 
npm ERR!     at Object.parse (native)
npm ERR!     at RegClient.<anonymous> (/home/smanastirliu/Scaricati/node-v0.10.5-linux-x86/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:235:23)
npm ERR!     at Request.self.callback (/home/smanastirliu/Scaricati/node-v0.10.5-linux-x86/lib/node_modules/npm/node_modules/request/index.js:142:22)
npm ERR!     at Request.EventEmitter.emit (events.js:98:17)
npm ERR!     at Request.<anonymous> (/home/smanastirliu/Scaricati/node-v0.10.5-linux-x86/lib/node_modules/npm/node_modules/request/index.js:856:14)
npm ERR!     at Request.EventEmitter.emit (events.js:117:20)
npm ERR!     at IncomingMessage.<anonymous> (/home/smanastirliu/Scaricati/node-v0.10.5-linux-x86/lib/node_modules/npm/node_modules/request/index.js:808:12)
npm ERR!     at IncomingMessage.EventEmitter.emit (events.js:117:20)
npm ERR!     at _stream_readable.js:895:16
npm ERR!     at process._tickCallback (node.js:415:13)
npm ERR! If you need help, 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! System Linux 3.5.0-27-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "underscore"
npm ERR! cwd /home/smanastirliu
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm ERR! type unexpected_token
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/smanastirliu/npm-debug.log
npm ERR! not ok code 0

and here is the debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'underscore' ]
2 info using npm@1.2.18
3 info using node@v0.10.5
4 verbose node symlink /usr/local/bin/node
5 verbose read json /home/smanastirliu/package.json
6 verbose read json /home/smanastirliu/package.json
7 verbose cache add [ 'underscore', null ]
8 verbose cache add name=undefined spec="underscore" args=["underscore",null]
9 verbose parsed url { protocol: null,
9 verbose parsed url   slashes: null,
9 verbose parsed url   auth: null,
9 verbose parsed url   host: null,
9 verbose parsed url   port: null,
9 verbose parsed url   hostname: null,
9 verbose parsed url   hash: null,
9 verbose parsed url   search: null,
9 verbose parsed url   query: null,
9 verbose parsed url   pathname: 'underscore',
9 verbose parsed url   path: 'underscore',
9 verbose parsed url   href: 'underscore' }
10 silly lockFile 64bc6893-underscore underscore
11 verbose lock underscore /home/smanastirliu/.npm/64bc6893-underscore.lock
12 silly lockFile 64bc6893-underscore underscore
13 silly lockFile 64bc6893-underscore underscore
14 verbose addNamed [ 'underscore', '' ]
15 verbose addNamed [ null, '' ]
16 silly lockFile 7629b758-underscore underscore@
17 verbose lock underscore@ /home/smanastirliu/.npm/7629b758-underscore.lock
18 silly addNameRange { name: 'underscore', range: '', hasData: false }
19 verbose url raw underscore
20 verbose url resolving [ 'http://registry.npmjs.org/', './underscore' ]
21 verbose url resolved http://registry.npmjs.org/underscore
22 info trying registry request attempt 1 at 16:38:48
23 http GET http://registry.npmjs.org/underscore
24 http 404 http://registry.npmjs.org/underscore
25 verbose bad json <html>
25 verbose bad json   <head>
25 verbose bad json     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
25 verbose bad json     <script type="text/javascript" language="JavaScript" src="http://img.sedoparking.com/registrar/dopark.js"></script>
25 verbose bad json   </head>
25 verbose bad json   <body style="display: none;">
25 verbose bad json     <script type="text/javascript">
25 verbose bad json var reg = 'sedonewreg';
25 verbose bad json document.write( '<scr'+'ipt type="text/javascript" language="JavaScript"' + 'src="http://sedoparking.com/' + window.location.host + '/' + reg + '/park.js">' + '<\/scr' + 'ipt>' );
25 verbose bad json     </script>
25 verbose bad json  </body>
25 verbose bad json </html>
26 error registry error parsing json
27 silly registry.get cb [ 404,
27 silly registry.get   { date: 'Mon, 29 Apr 2013 14:39:02 GMT',
27 silly registry.get     server: 'Apache',
27 silly registry.get     'content-length': '521',
27 silly registry.get     connection: 'close',
27 silly registry.get     'content-type': 'text/html; charset=UTF-8' } ]
28 silly lockFile 7629b758-underscore underscore@
29 silly lockFile 7629b758-underscore underscore@
30 error SyntaxError: Unexpected token <
30 error <html>
30 error   <head>
30 error     <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
30 error     <script type="text/javascript" language="JavaScript" src="http://img.sedoparking.com/registrar/dopark.js"></script>
30 error   </head>
30 error   <body style="display: none;">
30 error     <script type="text/javascript">
30 error var reg = 'sedonewreg';
30 error document.write( '<scr'+'ipt type="text/javascript" language="JavaScript"' + 'src="http://sedoparking.com/' + window.location.host + '/' + reg + '/park.js">' + '<\/scr' + 'ipt>' );
30 error     </script>
30 error  </body>
30 error </html>
30 error
30 error     at Object.parse (native)
30 error     at RegClient.<anonymous> (/home/smanastirliu/Scaricati/node-v0.10.5-linux-x86/lib/node_modules/npm/node_modules/npm-registry-client/lib/request.js:235:23)
30 error     at Request.self.callback (/home/smanastirliu/Scaricati/node-v0.10.5-linux-x86/lib/node_modules/npm/node_modules/request/index.js:142:22)
30 error     at Request.EventEmitter.emit (events.js:98:17)
30 error     at Request.<anonymous> (/home/smanastirliu/Scaricati/node-v0.10.5-linux-x86/lib/node_modules/npm/node_modules/request/index.js:856:14)
30 error     at Request.EventEmitter.emit (events.js:117:20)
30 error     at IncomingMessage.<anonymous> (/home/smanastirliu/Scaricati/node-v0.10.5-linux-x86/lib/node_modules/npm/node_modules/request/index.js:808:12)
30 error     at IncomingMessage.EventEmitter.emit (events.js:117:20)
30 error     at _stream_readable.js:895:16
30 error     at process._tickCallback (node.js:415:13)
31 error If you need help, you may report this log at:
31 error     <http://github.com/isaacs/npm/issues>
31 error or email it to:
31 error     <npm-@googlegroups.com>
32 error System Linux 3.5.0-27-generic
33 error command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "underscore"
34 error cwd /home/smanastirliu
35 error node -v v0.10.5
36 error npm -v 1.2.18
37 error type unexpected_token
38 verbose exit [ 1, true ]

Another example with Karma:

sudo npm install karma
npm http GET http://registry.npmjs.org/karma
npm http 304 http://registry.npmjs.org/karma
npm http GET http://registry.npmjs.org/http-proxy
npm http GET http://registry.npmjs.org/glob
npm http GET http://registry.npmjs.org/minimatch
npm http GET http://registry.npmjs.org/optimist/0.3.5
npm http GET http://registry.npmjs.org/coffee-script
npm http GET http://registry.npmjs.org/rimraf
npm http GET http://registry.npmjs.org/xmlbuilder/0.4.2
npm http GET http://registry.npmjs.org/q
npm http GET http://registry.npmjs.org/LiveScript/1.0.1
npm http GET http://registry.npmjs.org/colors/0.6.0-1
npm http GET http://registry.npmjs.org/dateformat/1.0.2-1.2.3
npm http GET http://registry.npmjs.org/istanbul/0.1.22
npm http GET http://registry.npmjs.org/growly
npm http GET http://registry.npmjs.org/lodash
npm http GET http://registry.npmjs.org/pause/0.0.1
npm http GET http://registry.npmjs.org/mime
npm http GET http://registry.npmjs.org/log4js
npm http GET http://registry.npmjs.org/socket.io
npm http GET http://registry.npmjs.org/chokidar
npm http 304 http://registry.npmjs.org/minimatch
npm http 304 http://registry.npmjs.org/glob
npm http 304 http://registry.npmjs.org/optimist/0.3.5
npm http 304 http://registry.npmjs.org/coffee-script
npm http 304 http://registry.npmjs.org/xmlbuilder/0.4.2
npm http 304 http://registry.npmjs.org/rimraf
npm http 304 http://registry.npmjs.org/q
npm http 304 http://registry.npmjs.org/LiveScript/1.0.1
npm http 304 http://registry.npmjs.org/dateformat/1.0.2-1.2.3
npm http 304 http://registry.npmjs.org/growly
npm http 304 http://registry.npmjs.org/istanbul/0.1.22
npm http 304 http://registry.npmjs.org/colors/0.6.0-1
npm http 304 http://registry.npmjs.org/lodash
npm http 304 http://registry.npmjs.org/mime
npm http 304 http://registry.npmjs.org/pause/0.0.1
npm http 304 http://registry.npmjs.org/log4js
npm http 304 http://registry.npmjs.org/socket.io
npm http 304 http://registry.npmjs.org/chokidar
npm http 200 http://registry.npmjs.org/http-proxy
npm http GET http://registry.npmjs.org/http-proxy/-/http-proxy-0.10.2.tgz
npm http 200 http://registry.npmjs.org/http-proxy/-/http-proxy-0.10.2.tgz
npm http GET http://registry.npmjs.org/graceful-fs
npm http GET http://registry.npmjs.org/lru-cache
npm http GET http://registry.npmjs.org/sigmund
npm http GET http://registry.npmjs.org/graceful-fs
npm http GET http://registry.npmjs.org/inherits
npm http GET http://registry.npmjs.org/wordwrap
npm http GET http://registry.npmjs.org/base64id/0.1.0
npm http GET http://registry.npmjs.org/socket.io-client/0.9.11
npm http GET http://registry.npmjs.org/policyfile/0.0.4
npm http GET http://registry.npmjs.org/redis/0.7.3
npm http GET http://registry.npmjs.org/async/0.1.15
npm http GET http://registry.npmjs.org/dequeue/1.0.3
npm http GET http://registry.npmjs.org/prelude-ls
npm http GET http://registry.npmjs.org/semver
npm http GET http://registry.npmjs.org/readable-stream
npm http GET http://registry.npmjs.org/esprima
npm http GET http://registry.npmjs.org/escodegen
npm http GET http://registry.npmjs.org/handlebars
npm http GET http://registry.npmjs.org/mkdirp
npm http GET http://registry.npmjs.org/nopt
npm http GET http://registry.npmjs.org/fileset
npm http GET http://registry.npmjs.org/which
npm http GET http://registry.npmjs.org/async
npm http GET http://registry.npmjs.org/abbrev
npm http GET http://registry.npmjs.org/wordwrap
npm http 200 http://registry.npmjs.org/graceful-fs
npm http GET http://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.0.tgz
npm http 200 http://registry.npmjs.org/graceful-fs
npm http 200 http://registry.npmjs.org/inherits
npm http GET http://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz
npm http GET http://registry.npmjs.org/pkginfo
npm http GET http://registry.npmjs.org/utile
npm http 200 http://registry.npmjs.org/base64id/0.1.0
npm http GET http://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz
npm http 200 http://registry.npmjs.org/wordwrap
npm http GET http://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz
npm http 200 http://registry.npmjs.org/lru-cache
npm http GET http://registry.npmjs.org/lru-cache/-/lru-cache-2.3.0.tgz
npm http 200 http://registry.npmjs.org/policyfile/0.0.4
npm http GET http://registry.npmjs.org/policyfile/-/policyfile-0.0.4.tgz
npm http 200 http://registry.npmjs.org/dequeue/1.0.3
npm http 200 http://registry.npmjs.org/async/0.1.15
npm http GET http://registry.npmjs.org/dequeue/-/dequeue-1.0.3.tgz
npm http GET http://registry.npmjs.org/async/-/async-0.1.15.tgz
npm http 200 http://registry.npmjs.org/socket.io-client/0.9.11
npm http GET http://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.11.tgz
npm http 200 http://registry.npmjs.org/redis/0.7.3
npm http GET http://registry.npmjs.org/redis/-/redis-0.7.3.tgz
npm http 200 http://registry.npmjs.org/prelude-ls
npm http GET http://registry.npmjs.org/prelude-ls/-/prelude-ls-0.6.0.tgz
npm http 200 http://registry.npmjs.org/semver
npm http GET http://registry.npmjs.org/semver/-/semver-1.1.4.tgz
npm http 200 http://registry.npmjs.org/esprima
npm http GET http://registry.npmjs.org/esprima/-/esprima-0.9.9.tgz
npm http 200 http://registry.npmjs.org/mkdirp
npm http GET http://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm http 200 http://registry.npmjs.org/handlebars
npm http GET http://registry.npmjs.org/handlebars/-/handlebars-1.0.10.tgz
npm http 200 http://registry.npmjs.org/fileset
npm http GET http://registry.npmjs.org/fileset/-/fileset-0.1.5.tgz
npm http 200 http://registry.npmjs.org/nopt
npm http GET http://registry.npmjs.org/nopt/-/nopt-2.0.0.tgz
npm http 200 http://registry.npmjs.org/which
npm http GET http://registry.npmjs.org/which/-/which-1.0.5.tgz
npm http 200 http://registry.npmjs.org/escodegen
npm http GET http://registry.npmjs.org/escodegen/-/escodegen-0.0.22.tgz
npm http 200 http://registry.npmjs.org/abbrev
npm http GET http://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz
npm http 200 http://registry.npmjs.org/wordwrap
npm http 200 http://registry.npmjs.org/graceful-fs/-/graceful-fs-1.2.0.tgz
npm http 200 http://registry.npmjs.org/inherits/-/inherits-1.0.0.tgz
npm http 200 http://registry.npmjs.org/pkginfo
npm http GET http://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz
npm http 200 http://registry.npmjs.org/base64id/-/base64id-0.1.0.tgz
npm http 200 http://registry.npmjs.org/wordwrap/-/wordwrap-0.0.2.tgz
npm http 200 http://registry.npmjs.org/lru-cache/-/lru-cache-2.3.0.tgz
npm http 200 http://registry.npmjs.org/policyfile/-/policyfile-0.0.4.tgz
npm http 200 http://registry.npmjs.org/readable-stream
npm http GET http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.2.tgz
npm http 200 http://registry.npmjs.org/utile
npm http GET http://registry.npmjs.org/utile/-/utile-0.1.7.tgz
npm http 200 http://registry.npmjs.org/async/-/async-0.1.15.tgz
npm http 200 http://registry.npmjs.org/socket.io-client/-/socket.io-client-0.9.11.tgz
npm http 200 http://registry.npmjs.org/dequeue/-/dequeue-1.0.3.tgz
npm http 200 http://registry.npmjs.org/redis/-/redis-0.7.3.tgz
npm http 200 http://registry.npmjs.org/prelude-ls/-/prelude-ls-0.6.0.tgz
npm http 200 http://registry.npmjs.org/semver/-/semver-1.1.4.tgz
npm http 200 http://registry.npmjs.org/esprima/-/esprima-0.9.9.tgz
npm http 200 http://registry.npmjs.org/mkdirp/-/mkdirp-0.3.5.tgz
npm http 200 http://registry.npmjs.org/handlebars/-/handlebars-1.0.10.tgz
npm http 200 http://registry.npmjs.org/sigmund
npm http GET http://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz
npm http 200 http://registry.npmjs.org/fileset/-/fileset-0.1.5.tgz
npm http 200 http://registry.npmjs.org/nopt/-/nopt-2.0.0.tgz
npm http 200 http://registry.npmjs.org/which/-/which-1.0.5.tgz
npm http 200 http://registry.npmjs.org/async
npm http 200 http://registry.npmjs.org/escodegen/-/escodegen-0.0.22.tgz
npm http GET http://registry.npmjs.org/async/-/async-0.1.22.tgz
npm http 200 http://registry.npmjs.org/abbrev/-/abbrev-1.0.4.tgz
npm http 200 http://registry.npmjs.org/pkginfo/-/pkginfo-0.2.3.tgz
npm http 200 http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.2.tgz
npm http 200 http://registry.npmjs.org/utile/-/utile-0.1.7.tgz
npm http 200 http://registry.npmjs.org/sigmund/-/sigmund-1.0.0.tgz
npm http GET http://registry.npmjs.org/deep-equal
npm http 200 http://registry.npmjs.org/async/-/async-0.1.22.tgz
npm http GET http://registry.npmjs.org/i
npm http GET http://registry.npmjs.org/ncp
npm http GET http://registry.npmjs.org/rimraf
npm http 200 http://registry.npmjs.org/deep-equal
npm http GET http://registry.npmjs.org/deep-equal/-/deep-equal-0.0.0.tgz
npm http 304 http://registry.npmjs.org/rimraf
npm http GET http://registry.npmjs.org/rimraf/-/rimraf-1.0.9.tgz
npm http 200 http://registry.npmjs.org/i
npm http GET http://registry.npmjs.org/i/-/i-0.3.1.tgz
npm http 200 http://registry.npmjs.org/deep-equal/-/deep-equal-0.0.0.tgz
npm http 200 http://registry.npmjs.org/rimraf/-/rimraf-1.0.9.tgz
npm http 200 http://registry.npmjs.org/ncp
npm http GET http://registry.npmjs.org/ncp/-/ncp-0.2.7.tgz
npm http 200 http://registry.npmjs.org/i/-/i-0.3.1.tgz
npm http 404 http://registry.npmjs.org/ncp/-/ncp-0.2.7.tgz
npm ERR! fetch failed http://registry.npmjs.org/ncp/-/ncp-0.2.7.tgz
npm ERR! Error: 404 Not Found
npm ERR!     at WriteStream.<anonymous> (/home/smanastirliu/Scaricati/node-v0.10.5-linux-x86/lib/node_modules/npm/lib/utils/fetch.js:57:12)
npm ERR!     at WriteStream.EventEmitter.emit (events.js:117:20)
npm ERR!     at fs.js:1596:14
npm ERR!     at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, 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! System Linux 3.5.0-27-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "karma"
npm ERR! cwd /home/smanastirliu
npm ERR! node -v v0.10.5
npm ERR! npm -v 1.2.18
npm http GET http://registry.npmjs.org/uglify-js/1.2.5
npm http GET http://registry.npmjs.org/ws
npm http GET http://registry.npmjs.org/xmlhttprequest/1.4.2
npm http GET http://registry.npmjs.org/active-x-obfuscator/0.0.1
npm http 404 http://registry.npmjs.org/uglify-js/1.2.5
npm ERR! registry error parsing json
npm http 404 http://registry.npmjs.org/xmlhttprequest/1.4.2
npm ERR! registry error parsing json
npm http 404 http://registry.npmjs.org/active-x-obfuscator/0.0.1
npm ERR! registry error parsing json
npm http 404 http://registry.npmjs.org/ws
npm ERR! registry error parsing json
npm http GET http://registry.npmjs.org/source-map
npm http GET http://registry.npmjs.org/estraverse
npm http GET http://registry.npmjs.org/esprima
npm http GET http://registry.npmjs.org/uglify-js
npm http 404 http://registry.npmjs.org/esprima
npm ERR! registry error parsing json
npm http 404 http://registry.npmjs.org/source-map
npm ERR! registry error parsing json
npm WARN optional dep failed, continuing source-map@>= 0.1.2
npm http GET http://registry.npmjs.org/esprima/-/esprima-1.0.2.tgz
npm http 404 http://registry.npmjs.org/estraverse
npm ERR! registry error parsing json
npm http 404 http://registry.npmjs.org/uglify-js
npm ERR! registry error parsing json
npm http 404 http://registry.npmjs.org/esprima/-/esprima-1.0.2.tgz
npm ERR! fetch failed http://registry.npmjs.org/esprima/-/esprima-1.0.2.tgz
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/smanastirliu/npm-debug.log
npm ERR! not ok code 0

Calling the packages url from browser I get a strange response (same response for any url):

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <script type="text/javascript" language="JavaScript" src="http://img.sedoparking.com/registrar/dopark.js"></script>
  </head>
  <body style="display: none;">
    <script type="text/javascript">
var reg = 'sedonewreg';
document.write( '<scr'+'ipt type="text/javascript" language="JavaScript"' + 'src="http://sedoparking.com/' + window.location.host + '/' + reg + '/park.js">' + '<\/scr' + 'ipt>' );
    </script>
 </body>
</html>

It seems to be a proxy error: I’m investigating

Whenever I want to install a module with NPM, it hangs at that stage:

npm install express
npm http GET https://registry.npmjs.org/express

And that’s it. It has that behavior for anything I input instead of express. I installed nodejs and nvm that way (Ubuntu 13.10):

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs

I tried looking on the Internet and GitHub and I found a closed issue about npm hanging forever when trying to install a module.. but it was a really old issue. Before I ask the developers, am I missing something obvious ?

I tried compiling both nodejs and npm but the result was the same.

EDIT: npm install express -verbose -> http://pastebin.com/tGY3V6Ly
Error:

npm info retry will retry, error on last attempt: Error: tunneling socket could not be established, cause=140072708810560:error:140770FC:SSL   routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:766:

Photo from Unsplash

The npm install command is used for installing JavaScript packages on your local computer.

When developing web projects, you may see issues that cause the npm install command to fail.

You need to see the error message generated in the terminal for clues to resolve the error.

Some of the most common issues for npm install not working are as follows:

  • npm command not found
  • No package.json file describing the dependencies
  • Integrity check failed error
  • For Windows: Python not found

Let’s see how you can resolve these errors next.

The npm command not found error

To run the npm install command, you need to have npm installed on your computer

$ npm install
sh: command not found: npm

The error above happens when npm can’t be found under the PATH environment variable.

First, you need to make sure that npm is installed on your computer.

npm is bundled with Node.js server, which you can download from the nodejs.org website.

Once you downloaded and installed Node.js, open the terminal and run the npm -v command.

You should see the version of npm installed on your computer as follows:

Once you see the npm version, you should be able to run the npm install command again.

For more details, visit the fixing npm command not found error article I’ve written previously.

ENOENT: No package.json file

The npm install command looks for a package.json file in order to find the packages it needs to install.

You need to make sure you have a package.json file right in the current directory where you run the command.

You can run the ls -1 command as follows:

$ ls -1
index.js
package-lock.json
package.json

Once you see there’s a package.json file in the output as shown above, then you can run the npm install command.

For this reason, you should always run the npm install command from the root directory of your project.

By the way, npm install will install packages already listed under the dependencies object of your package.json file.

Suppose you have a package.json file as shown below:

{
  "name": "n-app",
  "version": "1.0.0",
  "description": "A Node application",
  "dependencies": {
    "jest": "^28.1.1",
    "typescript": "^4.5.5",
    "webpack": "^2.7.0"
  }
}

Then npm install will install jest, typescript, and webpack to the generated node_modules/ folder.

If you need to install a new package, then you need to specify the name like these examples:

# 👇 install react package
npm install react

# 👇 install react, react-dom, and axios packages
npm install react react-dom axios

You can install one or many packages with the npm install command.

Integrity check failed error

When you have a package-lock.json file in your project, then npm will check the integrity of the package you downloaded with the one specified in the lock file.

When the checksum of the package is different, then npm will stop the installation and throw the integrity check failed error.

The following is an example of the error:

npm ERR! code EINTEGRITY
npm ERR! Verification failed while extracting @my-package@^1.2.0:
npm ERR! Verification failed while extracting @my-package@^1.2.0:
npm ERR! Integrity check failed:

npm ERR! Wanted: sha512-lQ...HA== 
npm ERR! Found:  sha512-Mj...vg==

When this happens, you can fix the issue by verifying the cache:

When the command is finished, run npm install again.

If you still see the error, then delete your lock file and clean the npm cache.

Run the following commands from your project’s root directory:

# 👇 remove the lock file
rm package-lock.json

# 👇 remove the node_modules folder
rm -rf node_modules

# 👇 Clear the npm cache
npm cache clean --force

# 👇 run npm install again
npm install

That should fix the issue with the integrity check.

For Windows only: Python not found

When running npm install on Windows, you may see an error that says Can’t find Python executable as shown below:

> node-gyp rebuild

/n-app>node "\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
npm http 304 https://registry.npmjs.org/bcrypt
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python",
you can set the PYTHON env variable.

The node-gyp module is a Node.js tool for compiling native modules written in C and C++. It requires Python to run properly.

Instead of installing Python by yourself, you can install the Windows Build Tools which has Python included.

This is because Windows also requires Visual Studio build tools to make node-gyp run successfully.

If you install only Python, then you may find that you need the build tools later.

Please note that the latest version of Node.js for Windows installer already includes the build tools by default.

But if you can’t update your Node.js version yet, then installing the build tools manually should help you fix this error.

Conclusion

The npm install command may fail to work because of many reasons.

When the command doesn’t work, you need to check the output first and see what specific error you have.

Try a Google search to fix the issue. When you don’t see a solution, try posting a new question at Stack Overflow mentioning the things you have tried to fix the issue.

Good luck resolving the issue! 👍

  • Home
  • Partition Manager
  • 5 Ways to Fix the Npm Install Not Working Issue

By Linda | Follow |
Last Updated

Npm is a package manager for Node.js. You can use it to download and install third-party packages and command-line programs written by others for local use. This post from MiniTool Partition Wizard shows you how to solve the npm install not working issue.

Npm Install Not Working

Npm, short for Node Package Manager, is the default package manager for Node.js, which is used to build scalable network applications. With npm, you can download and install third-party packages and command-line programs written by others from the NPM server for local use.

To install a module, you just need to run the “npm install <Module Name>” command. However, you may encounter npm install errors sometimes. For example:

  • Npm command not found.
  • Npm err code 1.
  • Can’t find Python executable “python”.
  • Integrity check failed.
  • Couldn’t read dependencies. No such file or directory ‘c:nodexxpackage.json’.

Why is the npm install not working? Possible reasons are as follows:

  • Npm is not installed.
  • There is no package.json file in the directory where you trying to run npm install.
  • The package name or the version is incorrect.
  • You are trying to install a package which has a dependency on system libraries, which is not being satisfied.

How to Fix the Npm Install Not Working Issue

To fix the npm install not working issue, you can use the following methods. But before proceeding, you should make sure you have typed the correct package name.

Way 1. Make Sure Npm Is Installed

The main cause of the npm command not found error is that npm is not installed. You can run the command “npm -v” to check whether npm is installed. If not, I recommend you uninstall Node.js and then reinstall node.js and npm. Please refer to this post: How to Install NPM and Node.js on Windows & Mac & Ubuntu.

Way 2. Make Sure There Is a Package.json File

When installing a package, npm needs to find the package.json file first. This file will list information about this package including name, version, description, keywords, dependencies, etc. If there is no package.json file, the npm install not working issue will occur. You can run the “ls -1” command to check whether there is a package.json file.

Way 3. Delete Lock File or Cache

The main reason for the integrity check failed error is usually the package-lock.json. When your project has this file, npm will check the integrity of the package you downloaded with the one specified in the lock file.

When the checksum of the package is different, then npm will stop the installation and throw the integrity check failed error. In this case, you can run the command “npm cache verify” to solve the problem.

If this command doesn’t work, you can run the command “rm package-lock.json” to delete the lock file, or run the command “npm cache clean –force” to clean the npm cache.

Way 4. Update Dependencies

One main reason for the npm err code 1 is that a dependency in the installed module is not compatible with the current node.js version. In this case, updating dependencies is a good solution. You can do that by running the command “npm update <packagename>”.

Way 5. Install the Latest Node.js

If you install the node-gyp module, you may get the “Can’t find Python” error. The node-gyp module is a Node.js tool for compiling native modules written in C and C++. It requires Python and Visual Studio build tools to run properly.

Fortunately, the latest version of Node.js for Windows installer already includes the build tools by default. Therefore, you just need to install the latest node.js and Python.

Bottom Line

Are you interested in MiniTool Partition Wizard? This software can help you clone the system, manage disks better, and recover data. If you have this need, you can download it from the official website.

About The Author

Linda

Position: Columnist

Linda has been working as an editor at MiniTool for 5 years. She is always curious about computer knowledge and learns it crazily. Her articles are simple and easy to understand. Even people who do not understand computer can gain something. By the way, her special focuses are disk management, data recovery and PDF editing.

Установка пакетов с использованием npm является незаменимым инструментом для разработчиков программного обеспечения. Однако, во время этого процесса могут возникнуть различные ошибки, которые могут замедлить или полностью остановить ваш рабочий процесс. В этой очень подробной статье мы рассмотрим наиболее распространенные ошибки, которые могут возникнуть при установке пакетов npm, а также предоставим возможные решения для каждой из них.

1. Ошибка доступа EACCES
Ошибка доступа EACCES является довольно распространенной проблемой, которую разработчики часто сталкиваются при установке пакетов npm. Она происходит, когда у вас недостаточно прав для записи в каталог npm. Вы можете получить такую ошибку при запуске команды npm install или npm install —save.

Решение:
Существует несколько способов решения проблемы доступа EACCES. Одним из них является запуск команды с использованием sudo, которая предоставит вам права администратора. Однако, этот метод не рекомендуется, так как использование sudo для выполнения команд npm может нарушить структуру прав доступа в вашей системе.

Более безопасным решением является изменение прав доступа к каталогу npm. Вы можете сделать это, добавив в команду npm config префикс —global или —save, в зависимости от вашего намерения установить глобальный пакет или пакет локально. Например:

npm config set prefix ‘~/.npm-global’

Затем вам следует добавить новые пути к переменной окружения PATH, чтобы команды npm были доступны из любого каталога. Для Unix-подобных систем, вы можете добавить следующую строку в файл .bashrc или .bash_profile:

export PATH=~/.npm-global/bin:$PATH

Для Windows вы можете использовать команду:

setx PATH «%AppData%\npm»

2. Ошибка ENOENT
ENOENT означает, что файл или каталог, на который ссылается команда npm, не найден. Эта ошибка может возникнуть во многих случаях, например, когда вам требуется установить пакет, используя неверное имя или версию.

Решение:
Сначала убедитесь, что вы правильно ввели имя пакета и версию. Используйте npm search, чтобы увидеть существующие пакеты, и npm view, чтобы получить дополнительную информацию о пакете, включая доступные версии.

Если ошибка ENOENT все еще сохраняется, возможно потребуется очистка кэша npm. Для этого выполните следующую команду:

npm cache clean

После этого повторите попытку установки пакета.

3. Ошибка EPERM
Ошибка EPERM возникает, когда операционная система не разрешает запрашиваемую операцию. Это может произойти, когда у вас нет прав на изменение или создание файлов в каталоге npm.

Решение:
Сначала убедитесь, что вы пытаетесь установить пакет с правильными правами доступа. Если вы устанавливаете пакет глобально, вы можете использовать префикс —global при запуске команды npm install.

Если проблема не решена, вы можете попробовать открыть терминал с правами администратора и запустить команду установки с использованием sudo. Однако, подобно проблеме доступа EACCES, использование sudo является небезопасной практикой и может вызвать проблемы с правами доступа.

4. Ошибка ENOTFOUND
Ошибка ENOTFOUND означает, что npm не может найти требуемый пакет в реестре пакетов. Это может быть вызвано различными причинами, такими как неправильное имя пакета или отсутствие соединения с Интернетом.

Решение:
Первым шагом является проверка правильности имени и версии пакета. Убедитесь, что вы правильно ввели имя пакета и версию в команде установки.

Если возникает проблема с подключением к Интернету, проверьте свое подключение и повторите попытку позже.

5. Ошибка ECONNREFUSED
Ошибка ECONNREFUSED возникает, когда соединение с удаленным сервером не удается установить. Это может быть вызвано различными факторами, включая блокировку порта или неправильную настройку прокси-сервера.

Решение:
Проверьте ваше подключение к Интернету и убедитесь, что вы подключены к сети. Если у вас есть антивирусное программное обеспечение или брандмауэры, убедитесь, что npm не блокируется ими.

Если вы используете прокси-сервер, убедитесь, что настройки прокси-сервера в вашей системе настроены правильно. Вы можете настроить прокси для команды npm с помощью следующих команд:

npm config set proxy http://proxy.company.com:8080

npm config set https-proxy http://proxy.company.com:8080

Где ‘proxy.company.com’ и ‘8080’ заменяются на фактические адрес и порт прокси-сервера.

Это только небольшая часть ошибок, которые могут возникнуть при установке пакетов npm. Важно помнить, что каждая ошибка может иметь разные причины и решения, поэтому следует внимательно изучить сообщение об ошибке и искать информацию в Интернете для нахождения соответствующего решения. Надеемся, что этот список вам поможет решить наиболее распространенные проблемы, с которыми вы можете столкнуться при использовании npm.

Понравилась статья? Поделить с друзьями:
  • Npm run serve vue ошибка
  • Nvse loader ошибка 740
  • Nvrtc64 102 0 dll как убрать ошибку
  • Nvms 1000 ошибка входа
  • Npm install windows ошибка