Suggestion related to clarifying use of synced folders

24 views
Skip to first unread message

Fernando Estrella

unread,
Apr 16, 2020, 4:38:48 AM4/16/20
to Vagrant
Hello

Yesterday I was working with Vagrant. I work with a team and I wanted the folder that vagrant opened into (/home/vagrant) when doing ssh to be the folder that would sync with the Vagrant folder in the host computer (where the Vagrantfile is) as opposed to it syncing in the /vagrant folder in the guest, so that they wouldn't have to move through folders so much. So I added another line to the Vagrantfile so achieve this. The thing is that when I ran with "npm install", it would install many things in the home folder, which now was syncing between the host and the guest, and that gave an error that was very hard to debug (it mentioned something like ENOENT and that a file could not be reached - sometimes different files would be mentioned - among others). Apparently when syncing it locks some files and npm install couldn't complete.

So my suggestion is to either make a note of this in the comments in the Vagrantfile, or on the website, or I don't know, whatever you guys suggest. 

Thanks!

dragon788

unread,
Apr 16, 2020, 7:57:05 AM4/16/20
to Vagrant
There are many options to sync folders, rsync, nfs, smb, 9p, Virtualbox or VMware native, some of these run into locking issues others don't.

I think the problem in your case may not be fully understanding why doing `npm install` in a synced location is a terrible idea. If your host operating system is Windows, it doesn't understand symlinks very well, and many of the shared/synced folder methods don't like them either, but npm uses symlinks heavily unless it detects that it is running on Windows, which it can't do when it is inside a VM.

For any projects requiring npm I almost always have better luck copying from /vagrant/my-project to /home/vagrant/my-project and then doing development and either pushing to version control from the copied location or manually copying back to the shared folder (and ignoring unnecessary files in the copy using the gitignore to greatly speed things up).

Fernando Estrella

unread,
Apr 16, 2020, 6:57:52 PM4/16/20
to vagra...@googlegroups.com
Thank you!

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/vagrant/issues
IRC: #vagrant on Freenode
---
You received this message because you are subscribed to a topic in the Google Groups "Vagrant" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/vagrant-up/oMHYxOuz-6g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to vagrant-up+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/79747ecf-f939-44e9-862a-f35fd702330b%40googlegroups.com.


--

Dennis Chang

unread,
Apr 16, 2020, 11:53:05 PM4/16/20
to Vagrant
Within the VM, the /vagrant directory (or /home/vagrant in your particular case) is mounted as vboxsf file system (and not ext2). Sometimes read/write of specific files will produce errors. I encountered this as well when trying to read VMDK files from shared folders.
Reply all
Reply to author
Forward
0 new messages