Verbose bad json errors installing jshint via node 0.10.25

I am trying to install jshint on a Mint Linux system using:

sudo npm install -g jshint

And I get the following error. The garbled error message fills my terminal buffer above this point.

#�:�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

However, I can less /home/rnichols/npm-debug.log and scroll down to the point where the problem appears to start, which I believe is here:

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

I can access https://registry.npmjs.org/lodash in my browser and it looks OK, so I'm not sure where the bad JSON is coming from.

How can I install jshint without getting this error?

Answers


There's an npm issue (they were gzipping responses which broke older versions): https://github.com/npm/npm/issues/12196


Upgrading npm to 3.8.5 fixed the problem.

As describe in https://askubuntu.com/questions/562417/how-do-you-update-npm-to-the-latest-version I had to run sudo npm install -g npm twice before npm would update.


Need Your Help

The collection is only added to, never read

java jpa netbeans collections persistence

Netbeans gives: Configure "unbalanced read/write with collections" for the declaration of headerFields:

Repeated subsetting can you make this process faster

r performance data.table

I need to loop through data table2 DT2 and for each row check if there is a match on some conditions in data table1 DT1.