无法使用节点npm安装任何软件包

时间:2013-04-29 13:50:30

标签: node.js ubuntu-12.04 npm

我正在尝试通过npm安装一些节点包,但它不会去。 我已经尝试过安装/ unistall / update节点,但似乎没什么用。

我正在使用ubuntu 12.04 - 以下是我尝试安装软件包的方法:

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

这是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 ]

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

从浏览器调用包url我得到一个奇怪的响应(任何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>

这似乎是代理错误:我正在调查

16 个答案:

答案 0 :(得分:73)

npm install <packagename> --registry http://registry.npmjs.org/

尝试使用install命令指定注册表。 解决了我的问题。

答案 1 :(得分:56)

我遇到了这个问题,正在做npm cache clean解决了这个问题。

答案 2 :(得分:28)

为了将来参考,如果npm is down也会发生这种情况。这就是我发现这个问题的方式。希望第一个npm任务是服务器状态检查,以便有更清晰的错误消息。

答案 3 :(得分:18)

由于某种原因,这与SSL有关。如果您将注册表设置为纯http,那么它应该工作。您可以通过以下方式将其设置为:

npm config set registry http://registry.npmjs.org/

或者如jairaj所说,你可以在命令行中提供它。

答案 4 :(得分:10)

1.&gt;转到您的位置

C:\Users\{your user name or ID}

2&GT;打开.npmrc&amp;从.npmrc文件中删除所有内容。

3.&gt;重新打开新的命令提示符

4.&gt;再次运行代码,将有效。

答案 5 :(得分:7)

翻译:

对我来说也是如此,特别是因为 package.json错误。 例如:

{
   "name": "app",
   "version": "0.0.0",
   "description": "any description",
   "main": "index.js",
   "author": "me", ->wrong
}

最后一个逗号被遗留下来,它给了我错误任何instalacción与此项目中的npm

然后:

{
   "name": "app",
   "version": "0.0.0",
   "description": "any description",
   "main": "index.js",
   "author": "me"
}

我希望它会有所帮助。

答案 6 :(得分:4)

问题在于ssl

你应该使用sudo。请按照以下方法解决问题。

如果您遇到此问题,请输入sudo npm config set strict-ssl false 密码:输入当前用户名密码

然后现在运行所有ur命令机智sudo sudo npm npm install -g下划线 密码:输入当前用户名密码

即使你得到错误也是如此。 你的代理将是问题。很少有公司代理被阻止,所以你应该使用wifi或开放网络来解决这个问题。

答案 7 :(得分:3)

尝试:

npm install underscore

:)

npm注册表中没有unserscore包。

答案 8 :(得分:2)

这对我有用(不使用代理):

  1. 为npm ..

    设置注册表镜像

    npm config set registry http://skimdb.npmjs.com/registry

  2. 从文档中找到镜像:https://docs.npmjs.com/misc/registry

    1. 在尝试npm install之后如果它有效,那么尝试安装你想要的任何东西,否则按照以下步骤
    2. 3.npm install -g handlebar //我这样做是因为它在npm日志中显示错误但你可以跳过

      4.之后尝试重新设置官方注册表

      DeletedObjectsIDs

      5.现在尝试安装你想要的任何包: - )

答案 9 :(得分:2)

如果有人专门获得Unexpected token <,并且您的package.json没问题,请检查您的 npm-shrinkwrap.json 文件!我的合并问题尚未解决,修复解决了所有问题。

答案 10 :(得分:1)

根据LAXIT KUMAR的建议,我们发现有时注册网址可能会被破坏,不确定这是怎么回事,但是为了治愈,只需重置它:

npm config set registry https://registry.npmjs.org

当404再次到达正确的位置时,404消失了。

答案 11 :(得分:0)

在安装gulp-preetify时,我在Ubuntu 15.10中也遇到了问题。

问题是:

  1. Registry returned 404 for GET on http://registry.npmjs.org/gulp-preetify

  2. 我尝试使用npm install gulp-preetify但它没有用。

  3. 我再次尝试使用:npm i gulp-preetify 它刚刚安装完毕。
  4. 我无法保证它能解决您的问题,但只需一次尝试就不会造成伤害。

答案 12 :(得分:0)

如果您不幸在代理服务器后面的网络和代理服务器后面的网络来回切换,您可能忘记了您的NPM配置设置为期望代理。

对我来说,我必须打开〜/ .npmrc并注释掉我的代理设置(在家里),反之亦然,在工作时(代理后面)。

答案 13 :(得分:0)

在我的安装结束时添加-g为我修复了这个问题。例如:     npm install uglify-js -g

答案 14 :(得分:0)

这意味着npm命令正在获取HTML文档,而不是正在寻找的任何格式。就我而言,我正在使用sinopia。当我不再想使用它时,我不小心使用此命令重置注册表:

npm config set registry https://www.npmjs.com/

这是错误的,应该是已经提到的命令here。 如果没有任何答案可以解决此问题,请阅读this,您可以找出错误网址的位置并将其清除,并将注册表设置为正确的网址:

npm config set registry https://registry.npmjs.org

答案 15 :(得分:-1)

您的package.json可能导致此问题。

解析你的package.json以找到意外的令牌

删除您的package.json文件并通过

创建一个
npm install