npm安装依赖报错
我在服务器上面执行npm install --production,结果出现了一堆的不是我依赖的模块。整个过程很长。下面的只是一部分
npm http 304 https://registry.npmjs.org/ansi-regex
npm http GET https://registry.npmjs.org/meow
npm http GET https://registry.npmjs.org/get-stdin
npm http 304 https://registry.npmjs.org/find-index
npm http 304 https://registry.npmjs.org/get-stdin
npm http 304 https://registry.npmjs.org/meow
npm http GET https://registry.npmjs.org/lodash._isnative
npm http GET https://registry.npmjs.org/lodash.isobject
npm http GET https://registry.npmjs.org/lodash._shimkeys
npm http GET https://registry.npmjs.org/lodash._escapehtmlchar
npm http GET https://registry.npmjs.org/lodash._reunescapedhtml
npm http GET https://registry.npmjs.org/wrappy
npm http GET https://registry.npmjs.org/lodash._objecttypes
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/brace-expansion
npm http GET https://registry.npmjs.org/core-util-is
npm http GET https://registry.npmjs.org/isarray/0.0.1
npm http GET https://registry.npmjs.org/concat-map/0.0.1
npm http GET https://registry.npmjs.org/balanced-match
npm http GET https://registry.npmjs.org/inherits
npm http GET https://registry.npmjs.org/inflight
然后经过很长时间之后,就报错了:
(rather than an array of `Cookie`s) to the callback. Simply maps the cookie array via `.toString()`.\u000a\u000a# CookieStore API\u000a\u000aThe storage model for
npm ERR! at Object.parse (native)
npm ERR! at RegClient.<anonymous> (/usr/lib/node_modules/npm-registry-client/lib/request.js:238:23)
npm ERR! at Request.self.callback (/usr/lib/node_modules/request/index.js:148:22)
npm ERR! at Request.emit (events.js:98:17)
npm ERR! at Request.<anonymous> (/usr/lib/node_modules/request/index.js:891:14)
npm ERR! at Request.emit (events.js:117:20)
npm ERR! at IncomingMessage.<anonymous> (/usr/lib/node_modules/request/index.js:842:12)
npm ERR! at IncomingMessage.emit (events.js:117:20)
npm ERR! at _stream_readable.js:938:16
npm ERR! at process._tickCallback (node.js:419: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 2.6.32-279.el6.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "--production"
npm ERR! cwd /home/lottery/fabu/web/svn
npm ERR! node -v v0.10.30
npm ERR! npm -v 1.3.6
npm ERR! type unexpected_eos
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/lottery/fabu/web/svn/npm-debug.log
npm ERR! not ok code 0
尝试了使用npm cache clear
清理缓存也不行,最后我们使用cnpm
做替换,才解决问题。
我想问一下,这个问题是什么原因导致的,该怎么解决?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
从代码来看是 npm 收到了不完整的 json 数据导致的错误,既然 cnpm 没问题,可能要归咎于网络问题了,你懂的。
https://github.com/npm/npm/blob/v1.3.6/node_modules/npm-registry-client/lib/request.js#L238
我和你一样,用npm不行,用cnpm安装就行 我的linux服务器是国外的,你找到原因了吗可以告诉我吗