简体   繁体   中英

Vagrant and installing packages in shared folder

I'm having trouble installing npm packages in vagrant.

I'm SSH inside vagrant and I'm trying to run sudo npm install gulp it doesnt work in the folder that vagrant shares between host and virtual machine.

But it works perfectly fine inside a seperate directory purely inside the VM.

This is part of the error I'm given:

npm ERR! Error: ENOENT, chmod '/vagrant/public/laravelproject/node_modules/gulp/node_modules/gulp-util/test/PluginError.js'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! System Linux 3.2.0-60-generic-pae
npm ERR! command "node" "/usr/local/bin/npm" "install" "gulp" "--save-dev"
npm ERR! cwd /vagrant/public/laravelproject
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.6
npm ERR! path /vagrant/public/laravelproject/node_modules/gulp/node_modules/gulp-util/test/PluginError.js
npm ERR! fstream_path /vagrant/public/laravelproject/node_modules/gulp/node_modules/gulp-util/test/PluginError.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call chmod
npm ERR! code ENOENT
npm ERR! errno 34

Anyone know how to give full access for the vm to access the directory on the host im trying to share with the VM, this is my vagrant config:

Vagrant.configure("2") do |c|
  c.vm.box = "precise32"
  c.vm.box_url = "http://files.vagrantup.com/precise32.box"
  c.vm.network :private_network, ip:"192.168.33.10"
  c.vm.synced_folder "./public", "/var/www/", owner:"root", group:"root"
end

Ok after ages of digging, I've found a solution which doesnt solve the problem fully but acts as a way to do what I want.

Here is where I found the answer Solution

But basically run npm install --no-bin-links [packagename]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM