Installing Vagrant and NPM in a shared folder

I have a vagrant virtual machine running Ubuntu 14 64bit. My host is Windows 8.1. I am trying to do an npm install on a shared folder (nodejs app) but even with

npm install --no-bin-links

      

it fails with

npm ERR! tar.unpack untar error /root/.npm/node-pre-gyp/0.6.8/package.tgz
npm ERR! tar.unpack untar error /root/.npm/node-pre-gyp/0.6.8/package.tgz
npm ERR! tar.unpack untar error /root/.npm/lodash-node/2.4.1/package.tgz
npm ERR! Linux 3.2.0-23-generic
npm ERR! argv "/usr/local/node/node-v0.12.7/bin/node" "/usr/local/node/node-default/bin/npm" "install" "--no-bin-links"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! path /vagrant_data/fe/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/node_modules/glob/node_modules/minimatch/node_
modules/brace-expansion/node_modules/concat-map/package.json.1e22b31c2e50debaced0adc67bb0250c
npm ERR! code EPERM
npm ERR! errno -1

npm ERR! Error: EPERM, open '/vagrant_data/fe/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/node_modules/glob/node_modules/
minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json.1e22b31c2e50debaced0adc67bb0250c'
npm ERR!     at Error (native)
npm ERR!  { [Error: EPERM, open '/vagrant_data/fe/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/node_modules/glob/node_modu
les/minimatch/node_modules/brace-expansion/node_modules/concat-map/package.json.1e22b31c2e50debaced0adc67bb0250c']
npm ERR!   errno: -1,
npm ERR!   code: 'EPERM',
npm ERR!   path: '/vagrant_data/fe/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/node_modules/fs-extra/node_modules/rimraf/node_modules/glob/node_modules/minimatch/n
ode_modules/brace-expansion/node_modules/concat-map/package.json.1e22b31c2e50debaced0adc67bb0250c' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Linux 3.2.0-23-generic
npm ERR! argv "/usr/local/node/node-v0.12.7/bin/node" "/usr/local/node/node-default/bin/npm" "install" "--no-bin-links"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! path npm-debug.log.2e07d69aba2393c854d2992b7057b4c0
npm ERR! code ETXTBSY
npm ERR! errno -26

npm ERR! ETXTBSY, rename 'npm-debug.log.2e07d69aba2393c854d2992b7057b4c0'
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!     /vagrant_data/fe/npm-debug.log

      

and I really can't figure out why. My npm version is 2.11.3. Can you help me?

+3


source to share


1 answer


I will answer my own question, maybe it will be useful to someone. This is a vagrant bug, here is the fix:

Github link

EDIT



for those who need details: I am running Vagrant 1.7.2 and VirtualBox 4.3.28. What I did to solve my problem was edit the file

# Lines 495-510 - C:\HashiCorp\Vagrant\embedded\gems\gems\vagrant-1.7.2\plugins\providers\virtualbox\driver\version_4_3.rb
def share_folders(folders)
  folders.each do |folder|
    args = ["--name",
      folder[:name],
      "--hostpath",
-       folder[:hostpath]]
+      '\\\\?\\' + folder[:hostpath].gsub(/[\/\\]/,'\\')]
    args << "--transient" if folder.key?(:transient) && folder[:transient]

    # Enable symlinks on the shared folder
    execute("setextradata", @uuid, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/#{folder[:name]}", "1")

    # Add the shared folder
    execute("sharedfolder", "add", @uuid, *args)
  end
end

      

as shown in the comment by Celtric ( link HERE ).

+2


source







All Articles