Cygwin上的NPM:意外的文件结束

spa*_*ain 17 cygwin node.js npm

我正在尝试在cygwin上使用NPM,但不断收到以下错误:

ERR! tar "-mvxpf" "-" "--no-same-owner" "-C" "/tmp/npm-1305893882865/1305893885765-0.008730818051844835/contents/___package.npm" tar: Unexpected EOF in archive
ERR! tar "-mvxpf" "-" "--no-same-owner" "-C" "/tmp/npm-1305893882865/1305893885765-0.008730818051844835/contents/___package.npm" tar: Unexpected EOF in archive
ERR! tar "-mvxpf" "-" "--no-same-owner" "-C" "/tmp/npm-1305893882865/1305893885765-0.008730818051844835/contents/___package.npm" tar: Error is not recoverable: exiting now
ERR! tar "-mvxpf" "-" "--no-same-owner" "-C" "/tmp/npm-1305893882865/1305893885765-0.008730818051844835/contents/___package.npm" 
ERR! Failed unpacking /tmp/npm-1305893882865/1305893885765-0.008730818051844835/tmp.tgz
ERR! couldn't unpack /tmp/npm-1305893882865/1305893885765-0.008730818051844835/tmp.tgz to /tmp/npm-1305893882865/1305893885765-0.008730818051844835/contents
verbose about to build /home/Tema/node_modules/express
ERR! error installing express@2.3.5 Error: Failed tar "-mvxpf" "-" "--no-same-owner" "-C" "/tmp/npm-1305893882865/1305893885765-0.008730818051844835/contents/___package.npm"
Run Code Online (Sandbox Code Playgroud)

我用google搜索了几个建议(npm cache clean和rebaseall),但没有任何帮助.那么,有没有办法在Cygwin中使用NPM?

And*_*ndz 2

我自己也经常遇到同样的问题。

我不知道如何修复它,但我确实知道错误会不规则地发生。如果您尝试再次安装 npm 包,它可能会起作用。只要继续重试,最终就会成功。

当它卡在 100% cpu 时,只需取消它(ctrl+c)并重试。另外,在安装软件包时不要切换到另一个窗口。

您也可以在文件夹内使用 wget 和 tar 手动安装软件包node_modules