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

时间:2016-06-19 20:56:52

标签: node.js npm vagrant puphpet

我正在尝试在OSX上的共享Vagrant文​​件夹中安装grunt软件包,该文件夹通过虚拟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来生成流浪汉机器。

以下是puphpet和config.yaml

使用的Vagrantfile

我该如何解决这个问题?

1 个答案:

答案 0 :(得分:0)

找到一种解决方法,通过在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