npm安装依赖报错

发布于 2022-08-31 20:40:17 字数 2768 浏览 13 评论 0

我在服务器上面执行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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

北恋 2022-09-07 20:40:17

从代码来看是 npm 收到了不完整的 json 数据导致的错误,既然 cnpm 没问题,可能要归咎于网络问题了,你懂的。

https://github.com/npm/npm/blob/v1.3.6/node_modules/npm-registry-client/lib/request.js#L238

护你周全 2022-09-07 20:40:17

我和你一样,用npm不行,用cnpm安装就行 我的linux服务器是国外的,你找到原因了吗可以告诉我吗

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文