Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using Vagrant with npm-linked dependencies

I'm evaluating a change in development process toward Vagrant, but I frequently develop interdependent, not-yet-released Node modules that are wired together npm link.

Since Vagrant doesn't have all the source files shared on the guest machine, the symlinks npm link creates are no longer sufficient as a means of developing these modules in sync with one another. For one, there doesn't seem to be any way to get npm link to create hard links. For two, sharing the symlink destinations across the board a la the following won't scale:

config.vm.synced_folder "/usr/local/share/npm/lib/node_modules", "/usr/lib/node_modules"

Now, the question. Is any of the above incorrect (e.g. npm support for hard links exists, and I missed it)? What processes have people used to develop interrelated, private Node modules with testing accomplished via Vagrant?

EDIT: Ultimately, I'm hoping for a solution that will work on both Mac & Windows. Also, for the record, I don't intend to intimate how hard linking a Node module would work; I'm just trying to leverage Vagrant to improve this not-uncommon workflow.

like image 974
Schoonology Avatar asked Aug 02 '13 02:08

Schoonology


1 Answers

Idea: instead of using the VM sync feature, use a sharing service in the VM to make the files accessible from the host OS.

For example, if your VM runs Linux and the host OS is Windows, you could start up samba and configure it to share the relevant directories. Then have the host OS map the samba share.

If the host OS is Mac, you could use something like macfuse to mount a directory over SSH to the VM.

Good luck!

like image 111
jimbo Avatar answered Nov 11 '22 08:11

jimbo