我在NodeJS
之前安装了npm
和apt-get
。它们都安装得很完美。
当我运行node -v
时,我得到以下内容
v0.10.25
当我运行npm -v
时,我得到以下内容
1.3.10
现在,当我到达我的项目根目录并尝试运行
时sudo npm install
我得到以下错误输出:
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
我的package.json如下:
{
"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在下面(在调试日志中没有错误)
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 ]
答案 0 :(得分:1)
我们遇到同样的问题,npm 1.3.10和节点0.10.25。目前无法全局升级npm。
我们目前的解决方法是在本地安装较新的npm,即
npm install npm@2.10.0
然后使用它来安装其他依赖项
nodejs node_modules/npm/bin/npm-cli install
答案 1 :(得分:0)
事实证明,NPM的人们正在测试gzip压缩包的元数据,因为带宽的节省将使每个人的安装更快,更可靠。不幸的是,npm @ 1.3及更早版本无法处理gzipped响应。令人遗憾的是,npm CLI团队不再支持npm@1.3了,因为它已经很老了(并且有错误)。
因此,缓存清理或旧版更新没有问题。虽然我在知道此问题之前确实将3.8.5 Latest
更新为node
并v4.4.2 LTS
更新为{{1}},但这解决了问题。