简体   繁体   中英

Npm install fails on Ubuntu

I installed NodeJS and npm by apt-get . Both of them gets installed perfectly.

When I run node -v I get the following

v0.10.25

When I run npm -v I get the following

1.3.10

Now when I get to my projects root directory and try to run

sudo npm install

I get the following output with errors:

npm http GET http://registry.npmjs.org/material-ui/0.14.0
npm http GET http://registry.npmjs.org/radium/0.16.6
npm http GET http://registry.npmjs.org/react-addons-css-transition-group/0.14.7
npm http GET http://registry.npmjs.org/react/0.14.7
npm http GET http://registry.npmjs.org/react-addons-pure-render-mixin/0.14.7
npm http GET http://registry.npmjs.org/react-addons-update/0.14.7
npm http GET http://registry.npmjs.org/react-dom/0.14.6
npm http GET http://registry.npmjs.org/react-lazyload/1.3.2
npm http GET http://registry.npmjs.org/react-progress-bar-plus/0.2.3
npm http GET http://registry.npmjs.org/react-router/2.0.0
npm http GET http://registry.npmjs.org/react-scroll/1.0.3
npm http GET http://registry.npmjs.org/react-tap-event-plugin/0.2.2
npm http GET http://registry.npmjs.org/babel-core/6.5.1
npm http GET http://registry.npmjs.org/babel-loader/6.2.2
npm http GET http://registry.npmjs.org/babel-preset-es2015/6.5.0
npm http GET http://registry.npmjs.org/babel-preset-react/6.5.0
npm http GET http://registry.npmjs.org/babelify/7.2.0
npm http GET http://registry.npmjs.org/css-loader/0.18.0
npm http GET http://registry.npmjs.org/require-dir/0.1.0
npm http GET http://registry.npmjs.org/style-loader/0.13.0
npm http GET http://registry.npmjs.org/transfer-webpack-plugin/0.1.4
npm http GET http://registry.npmjs.org/underscore/1.8.3
npm http GET http://registry.npmjs.org/webpack/1.12.13
npm http 200 http://registry.npmjs.org/radium/0.16.6
npm http 200 http://registry.npmjs.org/react-addons-css-transition-group/0.14.7
npm http GET http://registry.npmjs.org/react-addons-css-transition-group/-/react-addons-css-transition-group-0.14.7.tgz
npm http GET http://registry.npmjs.org/radium/-/radium-0.16.6.tgz
npm http 200 http://registry.npmjs.org/react/0.14.7
npm http GET http://registry.npmjs.org/react/-/react-0.14.7.tgz
npm http 200 http://registry.npmjs.org/react-addons-update/0.14.7
npm http GET http://registry.npmjs.org/react-addons-update/-/react-addons-update-0.14.7.tgz
npm http 200 http://registry.npmjs.org/react-addons-pure-render-mixin/0.14.7
npm http GET http://registry.npmjs.org/react-addons-pure-render-mixin/-/react-addons-pure-render-mixin-0.14.7.tgz
npm http 200 http://registry.npmjs.org/react-dom/0.14.6
npm http GET http://registry.npmjs.org/react-dom/-/react-dom-0.14.6.tgz
npm http 200 http://registry.npmjs.org/react-progress-bar-plus/0.2.3
npm http GET http://registry.npmjs.org/react-progress-bar-plus/-/react-progress-bar-plus-0.2.3.tgz
npm http 200 http://registry.npmjs.org/material-ui/0.14.0
npm http GET http://registry.npmjs.org/material-ui/-/material-ui-0.14.0.tgz
npm http 200 http://registry.npmjs.org/react-scroll/1.0.3
npm http GET http://registry.npmjs.org/react-scroll/-/react-scroll-1.0.3.tgz
npm http 200 http://registry.npmjs.org/react-router/2.0.0
npm http GET http://registry.npmjs.org/react-router/-/react-router-2.0.0.tgz
npm http 200 http://registry.npmjs.org/react-tap-event-plugin/0.2.2
npm http 200 http://registry.npmjs.org/react-lazyload/1.3.2
npm http 200 http://registry.npmjs.org/babel-core/6.5.1
npm http GET http://registry.npmjs.org/react-tap-event-plugin/-/react-tap-event-plugin-0.2.2.tgz
npm http GET http://registry.npmjs.org/react-lazyload/-/react-lazyload-1.3.2.tgz
npm http GET http://registry.npmjs.org/babel-core/-/babel-core-6.5.1.tgz
npm http 200 http://registry.npmjs.org/babel-loader/6.2.2
npm http GET http://registry.npmjs.org/babel-loader/-/babel-loader-6.2.2.tgz
npm http 200 http://registry.npmjs.org/babel-preset-react/6.5.0
npm ERR! registry error parsing json
npm ERR! SyntaxError: Unexpected token 
npm ERR! �Tێ�0����������o�jU�����

                                      `�/�M7�j��Y�Jڪ!0�3sf�x��� e)4D������.�    �r%�8�k�%���`}�A�4+�����}���nڒKK�ZW)���\� e�q&g�{�O�
6����֐��U����ض��p�z�����Ag����V̶�r�M��s��"��X��sފ���'Lrnu�:r��`.�$��f�s���m����                                                          �
                                          an�4_m��"
npm ERR! �$�l�0*�-��[z(
�_/j^ҸW�A�^�k��Z|�0�l���EZ�}�th5��t~����1���A�^��n%�3E�(re�+ꛓ+F������_/N�?�<�}�\@��f��&j������]���Y
                                                                                                                1   ���nS�����e̸
npm ERR! 
         �/�F�LVt���'�봆e1A\������=v�t�OO�y~$�A�a~ٱ�^�2�?�J�Y�f  y�(��w9O�/���   �������j�چ�8�ƫ��8\%�d�AYG��"��̹�
                                                                                                                                �ڰW^^~eR�
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 4.2.0-34-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/zeus/Glide/project/project-desktop
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! type unexpected_token
npm http 200 http://registry.npmjs.org/babelify/7.2.0
npm http GET http://registry.npmjs.org/babelify/-/babelify-7.2.0.tgz
npm http 200 http://registry.npmjs.org/babel-preset-es2015/6.5.0
npm http 200 http://registry.npmjs.org/css-loader/0.18.0
npm ERR! registry error parsing json
npm http GET http://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.5.0.tgz
npm http 200 http://registry.npmjs.org/underscore/1.8.3
npm ERR! registry error parsing json
npm http 200 http://registry.npmjs.org/require-dir/0.1.0
npm http 200 http://registry.npmjs.org/style-loader/0.13.0
npm ERR! registry error parsing json
npm http GET http://registry.npmjs.org/require-dir/-/require-dir-0.1.0.tgz
npm http 200 http://registry.npmjs.org/transfer-webpack-plugin/0.1.4
npm http GET http://registry.npmjs.org/transfer-webpack-plugin/-/transfer-webpack-plugin-0.1.4.tgz
npm http 200 http://registry.npmjs.org/react-addons-css-transition-group/-/react-addons-css-transition-group-0.14.7.tgz
npm http 200 http://registry.npmjs.org/radium/-/radium-0.16.6.tgz
npm http 200 http://registry.npmjs.org/react/-/react-0.14.7.tgz
npm http 200 http://registry.npmjs.org/react-addons-update/-/react-addons-update-0.14.7.tgz
npm http 200 http://registry.npmjs.org/react-addons-pure-render-mixin/-/react-addons-pure-render-mixin-0.14.7.tgz
npm http 200 http://registry.npmjs.org/webpack/1.12.13
npm http GET http://registry.npmjs.org/webpack/-/webpack-1.12.13.tgz
npm http 200 http://registry.npmjs.org/react-dom/-/react-dom-0.14.6.tgz
npm http 200 http://registry.npmjs.org/react-progress-bar-plus/-/react-progress-bar-plus-0.2.3.tgz
npm http 200 http://registry.npmjs.org/material-ui/-/material-ui-0.14.0.tgz
npm http 200 http://registry.npmjs.org/react-scroll/-/react-scroll-1.0.3.tgz
npm http 200 http://registry.npmjs.org/react-router/-/react-router-2.0.0.tgz
npm http 200 http://registry.npmjs.org/react-tap-event-plugin/-/react-tap-event-plugin-0.2.2.tgz
npm http 200 http://registry.npmjs.org/react-lazyload/-/react-lazyload-1.3.2.tgz
npm http 200 http://registry.npmjs.org/babel-core/-/babel-core-6.5.1.tgz
npm http 200 http://registry.npmjs.org/babel-loader/-/babel-loader-6.2.2.tgz
npm http 200 http://registry.npmjs.org/babelify/-/babelify-7.2.0.tgz
npm http 200 http://registry.npmjs.org/babel-preset-es2015/-/babel-preset-es2015-6.5.0.tgz
npm http 200 http://registry.npmjs.org/require-dir/-/require-dir-0.1.0.tgz
npm http 200 http://registry.npmjs.org/transfer-webpack-plugin/-/transfer-webpack-plugin-0.1.4.tgz
npm http 200 http://registry.npmjs.org/webpack/-/webpack-1.12.13.tgz
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/zeus/Glide/project/project-desktop/npm-debug.log
npm ERR! not ok code 0

My package.json is as under:

{
  "name": "Project_Server",
  "version": "0.13.2",
  "description": "Project Desktop client",
  "repository": {
    "type": "git",
    "url": "https://github.com/callemall/material-ui.git"
  },
  "scripts": {
    "start": "webpack-dev-server --config webpack-dev-server.config.js --progress --inline --colors",
    "build": "webpack --config webpack-production.config.js --progress --colors"
  },
  "private": true,
  "devDependencies": {
    "babel-core": "6.5.1",
    "babel-loader": "6.2.2",
    "babel-preset-es2015": "6.5.0",
    "babel-preset-react": "6.5.0",
    "babelify": "7.2.0",
    "css-loader": "0.18.0",
    "require-dir": "0.1.0",
    "style-loader": "0.13.0",
    "transfer-webpack-plugin": "0.1.4",
    "underscore": "1.8.3",
    "webpack": "1.12.13"
  },
  "dependencies": {
    "material-ui": "0.14.0",
    "radium": "0.16.6",
    "react": "0.14.7",
    "react-addons-css-transition-group": "0.14.7",
    "react-addons-pure-render-mixin": "0.14.7",
    "react-addons-update": "0.14.7",
    "react-dom": "0.14.6",
    "react-lazyload": "1.3.2",
    "react-progress-bar-plus": "0.2.3",
    "react-router": "2.0.0",
    "react-scroll": "1.0.3",
    "react-tap-event-plugin": "0.2.2"
  }
}

npm-debug.log is below (No errors above this in debug-log)

441 http GET http://registry.npmjs.org/babel-loader/-/babel-loader-6.2.2.tgz
442 http 200 http://registry.npmjs.org/babel-preset-react/6.5.0
443 verbose bad json �\00\00\00\00\00�Tێ�0����������o�jU�����`�/�M7�j��cY�Jڪ!0�3sf�x��� e)4D������.�    �r%�8�k�%���`}�A�4+�����}���nڒKK�ZW)���\� e�q&g�{�O��
f�����/�'͔^��J  Ь�<+�����=��R��nx�������m@+˝2�O�:��J�kj��2�A[զ>���t`.�$��f�s���m����
�2��-f�A~Ɍ���ϭ�Bl';��Q����%����T��mg���s��"��X��sފ���'Lrnu�:r��
6����֐��U����ض��p�z�����Ag����V̶�r�Man�4_m��"
443 verbose bad json �$�l�0*�-��[z(�gx
�_/j^ҸW�A�^�k��Z|�0�l���EZ�}�th5��t~����1���A�^��n%�3E�(re�+ꛓ+F������_/N�?�<�}�\@��f��&j������]���Y1    ���nS�����e̸
443 verbose bad json �/�F�LVt���'�봆e1A\������=v�t��OO�y~$�A�a~ٱ�^�2�?�J�Y�f     y�(��w9O�/���   �������j�چ�8�ƫ��8\%�d�AYG��"��̹��ڰW^^~eR�\00\00
444 error registry error parsing json
445 silly registry.get cb [ 200,
445 silly registry.get   { server: 'CouchDB/1.5.0 (Erlang OTP/R16B03)',
445 silly registry.get     etag: '"2OLAOBPSX664F6WT145OT3DOD"',
445 silly registry.get     'content-type': 'application/json',
445 silly registry.get     'content-encoding': 'gzip',
445 silly registry.get     'cache-control': 'max-age=300',
445 silly registry.get     'content-length': '676',
445 silly registry.get     'accept-ranges': 'bytes',
445 silly registry.get     date: 'Tue, 05 Apr 2016 10:03:41 GMT',
445 silly registry.get     via: '1.1 varnish',
445 silly registry.get     age: '0',
445 silly registry.get     connection: 'keep-alive',
445 silly registry.get     'x-served-by': 'cache-ams4122-AMS',
445 silly registry.get     'x-cache': 'HIT',
445 silly registry.get     'x-cache-hits': '1',
445 silly registry.get     'x-timer': 'S1459850621.389755,VS0,VE99',
445 silly registry.get     vary: 'Accept' } ]
446 silly lockFile 51c7cdfc-babel-preset-react-6-5-0 babel-preset-react@6.5.0
447 silly lockFile 51c7cdfc-babel-preset-react-6-5-0 babel-preset-react@6.5.0
448 error SyntaxError: Unexpected token 
448 error �\00\00\00\00\00�Tێ�0����������o�jU�����`�/�M7�j��cY�Jڪ!0�3sf�x��� e)4D������.�   �r%�8�k�%���`}�A�4+�����}���nڒKK�ZW)���\� e�q&g�{�O��
f�����/�'͔^��J  Ь�<+�����=��R��nx�������m@+˝2�O�:��J�kj��2�A[զ>���t`.�$��f�s���m����
�2��-f�A~Ɍ���ϭ�Bl';��Q����%����T��mg���s��"��X��sފ���'Lrnu�:r��
6����֐��U����ض��p�z�����Ag����V̶�r�Man�4_m��"
448 error �$�l�0*�-��[z(�gx
�_/j^ҸW�A�^�k��Z|�0�l���EZ�}�th5��t~����1���A�^��n%�3E�(re�+ꛓ+F������_/N�?�<�}�\@��f��&j������]���Y1    ���nS�����e̸
448 error �/�F�LVt���'�봆e1A\������=v�t��OO�y~$�A�a~ٱ�^�2�?�J�Y�f    y�(��w9O�/���   �������j�چ�8�ƫ��8\%�d�AYG��"��̹��ڰW^^~eR�\00\00
448 error     at Object.parse (native)
448 error     at RegClient.<anonymous> (/usr/share/npm/node_modules/npm-registry-client/lib/request.js:238:23)
448 error     at Request.self.callback (/usr/lib/nodejs/request/index.js:148:22)
448 error     at Request.EventEmitter.emit (events.js:98:17)
448 error     at Request.<anonymous> (/usr/lib/nodejs/request/index.js:896:14)
448 error     at Request.EventEmitter.emit (events.js:117:20)
448 error     at IncomingMessage.<anonymous> (/usr/lib/nodejs/request/index.js:847:12)
448 error     at IncomingMessage.EventEmitter.emit (events.js:117:20)
448 error     at _stream_readable.js:920:16
448 error     at process._tickCallback (node.js:415:13)
449 error If you need help, you may report this log at:
449 error     <http://github.com/isaacs/npm/issues>
449 error or email it to:
449 error     <npm-@googlegroups.com>
450 error System Linux 4.2.0-34-generic
451 error command "/usr/bin/nodejs" "/usr/bin/npm" "install"
452 error cwd /home/zeus/Glide/project/project-desktop
453 error node -v v0.10.25
454 error npm -v 1.3.10
455 error type unexpected_token
456 verbose exit [ 1, true ]

We have same problem, npm 1.3.10 and node 0.10.25. Can't currently upgrade the npm globally.

Our current workaround is to install newer npm via the old one locally, ie.

npm install npm@2.10.0

And then use it to install other dependencies

nodejs node_modules/npm/bin/npm-cli install

It turns out that people at NPM were testing gzip compression for package metadata, because the savings in bandwidth would make installs faster and more reliable for everyone. Unfortunately, npm@1.3 and older can't handle gzipped responses. Doubly unfortunately, the npm CLI team doesn't support npm@1.3 anymore, as it's quite old (and buggy).

You can read about this issue from npm team here!

So there was no issue with cache cleaning or older updates. Although I did update my npm to 3.8.5 Latest and node to v4.4.2 LTS before knowing this problem and that resolved the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM