我希望在我无所事事的虚拟框中运行npm install。
但是,每当我运行npm install命令时,我的rsync就会执行。由于我的主机没有安装node_modules,因此只为我完全删除该文件夹。
我该怎么做才能使我无所事事的rsync忽略node_modules文件夹?
我无法将node_modules同步到客户机中,因为我的主机和客户机是两个不同的系统。到目前为止,我的vagrantfile看起来像这样。
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
Run Code Online (Sandbox Code Playgroud)
我通过执行流浪汉rsync
vagrant rsync-auto
Run Code Online (Sandbox Code Playgroud)
rsync__exclude以及rsync__auto需要2_
您需要将行重写为
config.vm.synced_folder "./", "/home/vagrant/app", type: "rsync", rsync__auto: true, rsync__exclude: ['./node_modules*']
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2673 次 |
| 最近记录: |