详细通过节点0.10.25安装jshint错误的JSON错误

我正在试图在Mint Linux系统上安装jshint,使用:

sudo npm install -g jshint 

我得到以下错误。 在这点之上,乱码错误信息填充我的terminal缓冲区。

 # : b8   <f+) m  r W^  Ä ?ՎZq   Î   >          eV{ Y Р ?   Hm    *Zm  `S  I} o           W@  W*w  c b b )f  z   )/  M 6  o  7   ^& Sר +   \ /6   n      g[   m    ~  ?  WX G k       {  npm ERR! at Object.parse (native) npm ERR! at RegClient.<anonymous> (/usr/share/npm/node_modules/npm-registry-client/lib/request.js:238:23) npm ERR! at Request.self.callback (/usr/lib/nodejs/request/index.js:148:22) npm ERR! at Request.EventEmitter.emit (events.js:98:17) npm ERR! at Request.<anonymous> (/usr/lib/nodejs/request/index.js:896:14) npm ERR! at Request.EventEmitter.emit (events.js:117:20) npm ERR! at IncomingMessage.<anonymous> (/usr/lib/nodejs/request/index.js:847:12) npm ERR! at IncomingMessage.EventEmitter.emit (events.js:117:20) npm ERR! at _stream_readable.js:920: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.19.0-32-generic npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "jshint" npm ERR! cwd /home/rnichols npm ERR! node -v v0.10.25 npm ERR! npm -v 1.3.10 npm ERR! type unexpected_token npm ERR! npm ERR! Additional logging details can be found in: npm ERR! /home/rnichols/npm-debug.log npm ERR! not ok code 0 

但是,我可以less /home/rnichols/npm-debug.log并向下滚动到问题似乎开始的地步,我相信这里是:

 252 http 200 https://registry.npmjs.org/lodash 253 verbose bad json ^_^@^@^@^@^@^D^C Y o 6^L W^D?' e˿ =t@_6ܞ  e ^U H' lː  u      ɺ    [ 253 verbose bad json 䡈^\ ^T   B      "h^L a^S, ESC [z  L y `Q^Vu^N B  253 verbose bad json  C^   (M*P9 w  cu AY ;m:   d  ^F FZ6: h I^S   N    >h     0^N>- -ځ Lo    ^W{  N  f^Q     e`M  ^]  7Ra  c    ^C @^Y     F:^F ho  =s ^U^_Y  d[ )d    N^F ^E  5  G    I^@  t a5J7 9či  k^O ƹ~ X   m *T ]U^T   a  }+ G 

我可以在我的浏览器中访问https://registry.npmjs.org/lodash ,它看起来很好,所以我不确定糟糕的JSON来自哪里。

我怎样才能安装jshint没有得到这个错误?

有一个npm的问题(他们gzip响应打破旧版本): https : //github.com/npm/npm/issues/12196

升级npm到3.8.5修复了这个问题。

正如在https://askubuntu.com/questions/562417/how-do-you-update-npm-to-the-latest-version中所描述的,我必须&#x5728;npm更新之前两次运行sudo npm install -g npm