简体   繁体   English

在共享文件夹中流浪并安装软件包

[英]Vagrant and installing packages in shared folder

I'm having trouble installing npm packages in vagrant. 我在流浪汉中安装npm软件包时遇到问题。

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. 我在流浪汉中使用SSH,并且尝试运行sudo npm install gulp它在流浪汉在主机和虚拟机之间共享的文件夹中不起作用。

But it works perfectly fine inside a seperate directory purely inside the VM. 但是,在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] 但基本上运行npm install --no-bin-links [packagename]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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