title: How to exclude (ignore) certain folders in vagrant rsync?
body: <p>I wish to run npm install in my vagrant virtual box.</p>
  
  <p>But whenever I ran the npm install command, my rsync will execute. Since my host computer does not have node_modules installed, it simply remove the folder completely for me.</p>
  
  <p>What do I need to do so that my vagrant rsync will ignore the node_modules folder?</p>
  
  <p>I cannot have node_modules being rsynced into the guest machine because my host and guest are two different systems. So far my vagrantfile looks like this.</p>
  
  <pre><code>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
  </code></pre>
  
  <p>And I execute vagrant rsync via</p>
  
  <pre><code>vagrant rsync-auto
  </code></pre>