如何排除(忽略)vagrant rsync 中的某些文件夹?
How to exclude (ignore) certain folders in vagrant rsync?
我希望 运行 npm install 在我的 vag运行t 虚拟盒子中。
但是每当我 运行 npm install 命令时,我的 rsync 就会执行。由于我的主机没有安装 node_modules,它只是为我完全删除了文件夹。
我需要做什么才能让我的 vag运行t rsync 忽略 node_modules 文件夹?
我无法将 node_modules rsync 到来宾计算机,因为我的主机和来宾是两个不同的系统。到目前为止,我的 vag运行tfile 看起来像这样。
Vagrant.configure("2") do |config|
config.vm.box = "laravel/homestead"
config.vm.hostname = "localhost"
config.vm.network "forwarded_port", guest: 8000, host: 8000
config.vm.synced_folder "./", "/home/vagrant/app"
config.vm.provider "virtualbox" do |v|
v.name = "web2"
v.memory = "4096"
v.cpus = 2
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME", "1"]
end
config.vm.synced_folder "./", "/home/vagrant/app", type: "rsync", rsync_auto: true, rsync_exclude: ['node_modules*']
config.vm.provision :shell, path: "provision/setup.sh"
end
然后我通过
执行vag运行t rsync
vagrant rsync-auto
rsync__exclude
以及 rsync__auto
需要 2 _
您需要将您的行重写为
config.vm.synced_folder "./", "/home/vagrant/app", type: "rsync", rsync__auto: true, rsync__exclude: ['./node_modules*']
http://perrymitchell.net/article/npm-symlinks-through-vagrant-windows/ 上的第 3 步最终对我来说效果更好...
来自页面:
The steps are simple:
Delete the node_modules directory if it exists.
Create a directory called, say "node_modules_projectname" in the VM's home directory (~) (Some articles and posts recommend making the
directory in /tmp, but obviously this is cleared on reboot, so it may
not be an optimal experience for this type of thing).
Link a local node_modules dir from within the project's directory
ln -s ~/node_modules_projectname /path/to/your-project/node_modules
Install the packages in the project directory:
npm install
我希望 运行 npm install 在我的 vag运行t 虚拟盒子中。
但是每当我 运行 npm install 命令时,我的 rsync 就会执行。由于我的主机没有安装 node_modules,它只是为我完全删除了文件夹。
我需要做什么才能让我的 vag运行t rsync 忽略 node_modules 文件夹?
我无法将 node_modules rsync 到来宾计算机,因为我的主机和来宾是两个不同的系统。到目前为止,我的 vag运行tfile 看起来像这样。
Vagrant.configure("2") do |config|
config.vm.box = "laravel/homestead"
config.vm.hostname = "localhost"
config.vm.network "forwarded_port", guest: 8000, host: 8000
config.vm.synced_folder "./", "/home/vagrant/app"
config.vm.provider "virtualbox" do |v|
v.name = "web2"
v.memory = "4096"
v.cpus = 2
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME", "1"]
end
config.vm.synced_folder "./", "/home/vagrant/app", type: "rsync", rsync_auto: true, rsync_exclude: ['node_modules*']
config.vm.provision :shell, path: "provision/setup.sh"
end
然后我通过
执行vag运行t rsyncvagrant rsync-auto
rsync__exclude
以及 rsync__auto
需要 2 _
您需要将您的行重写为
config.vm.synced_folder "./", "/home/vagrant/app", type: "rsync", rsync__auto: true, rsync__exclude: ['./node_modules*']
http://perrymitchell.net/article/npm-symlinks-through-vagrant-windows/ 上的第 3 步最终对我来说效果更好...
来自页面:
The steps are simple:
Delete the node_modules directory if it exists.
Create a directory called, say "node_modules_projectname" in the VM's home directory (~) (Some articles and posts recommend making the directory in /tmp, but obviously this is cleared on reboot, so it may not be an optimal experience for this type of thing).
Link a local node_modules dir from within the project's directory
ln -s ~/node_modules_projectname /path/to/your-project/node_modules
Install the packages in the project directory:
npm install