【问题标题】:npm install causes errors like npm ERR! tar.unpack untar error on Debiannpm install 会导致诸如 npm ERR 之类的错误! Debian 上的 tar.unpack 解压错误
【发布时间】:2015-06-05 12:19:08
【问题描述】:

按照Bootstrap documentation 所示安装 Grunt,我首先使用 npm install -g grunt-cli 全局安装了 grunt-cli,现在我尝试执行 npm install,但只会出现错误:

root@devvm:/var/www/axit/portfolio/public/bower_components/bootstrap# npm install
npm ERR! tar.unpack untar error /root/.npm/wrappy/1.0.1/package.tgz
npm ERR! tar.unpack untar error /root/.npm/wrappy/1.0.1/package.tgz
npm ERR! tar.unpack untar error /root/.npm/brace-expansion/1.1.0/package.tgz
npm ERR! tar.unpack untar error /root/.npm/delayed-stream/0.0.5/package.tgz
npm WARN optional dep failed, continuing form-data@0.1.4
npm ERR! tar.unpack untar error /root/.npm/is-property/1.0.2/package.tgz
npm WARN optional dep failed, continuing request@2.54.0
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.35
npm ERR! npm  v2.7.4
npm ERR! path /var/www/axit/portfolio/public/bower_components/bootstrap/node_modules/grunt-saucelabs/node_modules/sauce-tunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js
npm ERR! code EPERM
npm ERR! errno 50

npm ERR! Error: EPERM, open '/var/www/axit/portfolio/public/bower_components/bootstrap/node_modules/grunt-saucelabs/node_modules/sauce-tunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js'
npm ERR!  { [Error: EPERM, open '/var/www/axit/portfolio/public/bower_components/bootstrap/node_modules/grunt-saucelabs/node_modules/sauce-tunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js']
npm ERR!   errno: 50,
npm ERR!   code: 'EPERM',
npm ERR!   path: '/var/www/axit/portfolio/public/bower_components/bootstrap/node_modules/grunt-saucelabs/node_modules/sauce-tunnel/node_modules/request/node_modules/form-data/node_modules/combined-stream/node_modules/delayed-stream/test/integration/test-delayed-http-upload.js' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.35
npm ERR! npm  v2.7.4
npm ERR! path npm-debug.log.ba707f2a7a688e388708bbe88e2dd4ed
npm ERR! code ETXTBSY
npm ERR! errno 62

npm ERR! ETXTBSY, rename 'npm-debug.log.ba707f2a7a688e388708bbe88e2dd4ed'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/axit/portfolio/public/bower_components/bootstrap/npm-debug.log

我刚刚将项目复制到一个非共享文件夹中并再次启动npm install。它奏效了。所以,这似乎是一个共享文件夹问题。但究竟是什么? Symlinks are enabled 用于此共享文件夹,我以管理员身份启动了 VM(当我在安装 Bower 时遇到类似问题时,它有所帮助)。

是什么导致了这些错误以及如何解决这个问题?

环境:带有 Debian 来宾系统和 Windows 7 主机系统的 VirtualBox。

编辑

现在(我认为在非共享文件夹中成功执行 npm install 之后)我得到了不同的错误:

当我以普通方式启动虚拟机时:

root@devvm:/var/www/axit/portfolio/public/bower_components/bootstrap# npm install
npm ERR! tar.unpack untar error /root/.npm/delayed-stream/0.0.5/package.tgz
npm WARN optional dep failed, continuing form-data@0.1.4
npm ERR! tar.unpack untar error /root/.npm/wrappy/1.0.1/package.tgz
npm ERR! tar.unpack untar error /root/.npm/wrappy/1.0.1/package.tgz
npm ERR! tar.unpack untar error /root/.npm/brace-expansion/1.1.0/package.tgz
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.35
npm ERR! npm  v2.7.4
npm ERR! path ../semver/bin/semver
npm ERR! code UNKNOWN
npm ERR! errno -1

npm ERR! UNKNOWN, symlink '../semver/bin/semver'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.35
npm ERR! npm  v2.7.4
npm ERR! path npm-debug.log.428531818e2d916d5ae79bdf94dd73b3
npm ERR! code ETXTBSY
npm ERR! errno 62

npm ERR! ETXTBSY, rename 'npm-debug.log.428531818e2d916d5ae79bdf94dd73b3'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/axit/portfolio/public/bower_components/bootstrap/npm-debug.log

当我以Administrator 启动虚拟机时:

root@devvm:/var/www/axit/portfolio/public/bower_components/bootstrap# npm install
npm ERR! tar.unpack untar error /root/.npm/wrappy/1.0.1/package.tgz
npm ERR! tar.unpack untar error /root/.npm/wrappy/1.0.1/package.tgz
npm ERR! tar.unpack untar error /root/.npm/delayed-stream/0.0.5/package.tgz
npm ERR! tar.unpack untar error /root/.npm/brace-expansion/1.1.0/package.tgz
npm WARN optional dep failed, continuing form-data@0.1.4
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.35
npm ERR! npm  v2.7.4
npm ERR! path /var/www/axit/portfolio/public/bower_components/bootstrap/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy
npm ERR! code UNKNOWN
npm ERR! errno -1

npm ERR! UNKNOWN, mkdir '/var/www/axit/portfolio/public/bower_components/bootstrap/node_modules/grunt-contrib-qunit/node_modules/grunt-lib-phantomjs/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/node_modules/glob/node_modules/once/node_modules/wrappy'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Linux 3.2.0-4-amd64
npm ERR! argv "node" "/usr/local/bin/npm" "install"
npm ERR! node v0.10.35
npm ERR! npm  v2.7.4
npm ERR! path npm-debug.log.0bb66467f3aae813a34e03a797f8da19
npm ERR! code ETXTBSY
npm ERR! errno 62

npm ERR! ETXTBSY, rename 'npm-debug.log.0bb66467f3aae813a34e03a797f8da19'
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /var/www/axit/portfolio/public/bower_components/bootstrap/npm-debug.log

【问题讨论】:

  • 我还没有尝试复制您的问题,但首先我想问您一个问题:您是否尝试过使用sudo 运行命令?因为这条线npm ERR! Please try running this command again as root/Administrator. 似乎暗示了这一点。像sudo npm install 这样的东西也许是解决方案。
  • 我是 Debian 来宾系统上的 root。而且我还在主机上以Administrator 的身份启动了VM。
  • 不确定,但在 this answer 和下面的 cmets 中,他们建议使用附加选项 --no-bin-link。您说安装 Bower 时遇到问题,可能仅启用符号链接还不够。
  • 刚刚试了一下。不,它没有奏效。

标签: linux node.js gruntjs npm virtualbox


【解决方案1】:

好的,我看到了解决方案

 sudo npm cache clean

然后

sudo npm install -g grunt grunt-cli

我是在 MacOS 上做的

【讨论】:

  • 感谢您的提示。对我来说,我必须使用 -f 选项调用命令:npm cache clean -f
【解决方案2】:

确保您的硬盘驱动器未满。这就是我的情况。

【讨论】:

    【解决方案3】:

    试试sudo npm cache clean。但看起来问题是路径对于 windows 来说太长了(260 字节限制)所以你不能共享目录。

    我尝试使用fenestrate,但对我来说没有用。您可能还想查看this entry

    【讨论】:

    • 感谢您的回答。经过多次尝试,终于奏效了。不知何故...我不记得了,我想,我使用了一种解决方法,但不记得它到底是什么。无论如何,如果我再次遇到此问题,我会尝试您的解决方案并提供反馈。
    【解决方案4】:

    我遇到了类似的错误,以下并没有立即解决问题:

    npm cache clean
    rm -rf node_modules
    npm install
    

    事实证明我的虚拟机上的磁盘空间已用完。在分配更多空间并运行以上命令后,一切都按预期工作。

    【讨论】:

    • 感谢有关空间的提示。同样的问题。
    【解决方案5】:

    我面临同样的问题,我尝试了这里建议的所有选项,但没有成功。最后,我在某处读到,我应该拥有超级用户权限,所以我做到了

     sudo -s 
    

    它似乎已经解决了这个问题。

    【讨论】:

    • 最好将文件夹的权限更改为用户拥有的权限,而不是使用 sudo。 Sudo 不太安全,总体上不推荐使用(因为它具有超级用户状态)
    【解决方案6】:

    对我来说 npm cache clean 没有用。 但是删除有问题的目录(npm remove)然后简单地重新安装包就可以了!

    【讨论】:

      【解决方案7】:

      在我的例子中,我尝试在 vagrant 中安装模块,上面没有任何工作,所以我尝试在主机 (OSX) 上安装它并且它工作。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2015-09-09
        • 2015-11-08
        • 1970-01-01
        • 1970-01-01
        • 2014-05-29
        • 2015-08-05
        • 2021-07-29
        • 2014-05-02
        相关资源
        最近更新 更多