tar.unpack 在 Ubuntu Vagrant 上 运行 npm install grunt 时出现解压错误

tar.unpack untar error when running npm install grunt on Ubuntu Vagrant

我正在尝试将 grunt 包安装在 OSX 上的共享 Vagrant 文件夹中,该文件夹通过虚拟 Ubuntu 14.04 机器上的 nfs 同步。

$ npm install grunt
npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm ERR! tar.unpack untar error /home/vagrant/.npm/abbrev/1.0.9/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/dateformat/1.0.2-1.2.3/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/colors/0.6.2/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/inherits/1.0.2/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/nopt/1.0.10/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/inherits/2.0.1/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/lru-cache/2.7.3/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/async/0.1.22/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/underscore.string/2.4.0/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/getobject/0.1.0/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/exit/0.1.2/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash/2.4.2/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/eventemitter2/0.4.14/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/underscore.string/2.3.3/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/grunt-legacy-log-utils/0.1.1/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/graceful-fs/1.2.3/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/hooker/0.2.3/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/grunt-legacy-log/0.1.3/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/iconv-lite/0.2.11/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash/2.4.2/package.tgz
npm WARN install:lodash@2.4.2 EPERM: operation not permitted, utime '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/lodash-e740bce0/package.json'
npm ERR! tar.unpack untar error /home/vagrant/.npm/underscore.string/2.3.3/package.tgz
npm WARN install:underscore.string@2.3.3 EPERM: operation not permitted, utime '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/underscore.string-478f4497/package.json'
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash/2.4.2/package.tgz
npm WARN install:lodash@2.4.2 EPERM: operation not permitted, utime '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/lodash-066a8478/package.json'
npm ERR! tar.unpack untar error /home/vagrant/.npm/lodash/0.9.2/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/rimraf/2.2.8/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/sigmund/1.0.1/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/minimatch/0.2.14/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/glob/3.1.21/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/minimatch/0.3.0/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/glob/3.2.11/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/findup-sync/0.1.3/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/underscore/1.7.0/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/which/1.0.9/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/argparse/0.1.16/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/underscore.string/2.2.1/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/grunt-legacy-util/0.2.0/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/grunt/0.4.5/package.tgz
npm ERR! tar.unpack untar error /home/vagrant/.npm/esprima/1.0.4/package.tgz
npm WARN install:esprima@1.0.4 EPERM: operation not permitted, utime '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/esprima-8320b64c/package.json'
npm ERR! tar.unpack untar error /home/vagrant/.npm/coffee-script/1.3.3/package.tgz
npm WARN install:coffee-script@1.3.3 EPERM: operation not permitted, utime '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/coffee-script-fbff1893/package.json'
npm ERR! tar.unpack untar error /home/vagrant/.npm/js-yaml/2.0.5/package.tgz
npm WARN install:js-yaml@2.0.5 EPERM: operation not permitted, utime '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/js-yaml-0f65429b/package.json'
npm ERR! Linux 3.19.0-25-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "grunt"
npm ERR! node v5.11.1
npm ERR! npm  v3.8.6
npm ERR! path /home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/abbrev-f598728e/package.json
npm ERR! code EPERM
npm ERR! errno -1
npm ERR! syscall utime

npm ERR! Error: EPERM: operation not permitted, utime '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/abbrev-f598728e/package.json'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM: operation not permitted, utime '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/abbrev-f598728e/package.json']
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'utime',
npm ERR!   path: '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/abbrev-f598728e/package.json',
npm ERR!   fstream_finish_call: 'utimes',
npm ERR!   fstream_type: 'File',
npm ERR!   fstream_path: '/home/vagrant/Code/bulbthings/Frontend/Angular3/node_modules/.staging/abbrev-f598728e/package.json',
npm ERR!   fstream_class: 'FileWriter',
npm ERR!   fstream_stack:
npm ERR!    [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/writer.js:306:21',
npm ERR!      'FSReqWrap.oncomplete (fs.js:82:15)' ],
npm ERR!   parent: 'BulbThings' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/vagrant/Code/bulbthings/Frontend/Angular3/npm-debug.log

完整 npm-debug.log

我试过 运行 npm cache clean 并再次删除 运行 之前的 node_modules 文件夹,同样的错误。

我用puphpet生成了vagrant机器

这是config.yaml used by puphpet and the Vagrantfile

我该如何解决这个问题?

找到了一种方法来解决此问题,方法是在同步文件夹中使用 vagrant 中的默认文件驱动程序,而不是 NFS,尽管这确实会使它在 OSX.

上变慢很多

已更改

synced_folder:
            vflsf_2ll1rv82p2ge:
                source: ~/Code
                target: /home/vagrant/Code
                sync_type: nfs

synced_folder:
            vflsf_2ll1rv82p2ge:
                source: ~/Code
                target: /home/vagrant/Code
                sync_type: default