Hi, Steve:

I've also encountered problems with symlinks when running under c:\vagrant,
and for the same reasons.  As we've discussed on IRC and in other meetings,
I worked around these by mounting the share as a named drive (I use V: for
"Vagrant").  This has worked very well at least in my experience, as long
as I remember to clean out node_modules in the host environment or use
rimraf within the VM.

I do like that your approach helps with the node_modules problem, but I
wonder about new material.  By that I mean, if a command or tests generate
reports or other output, with the "shared drive" approach, you end up
having access to the reports from the host VM, being able to check for lock
file staleness (see previous email).  If you symlink the .git directory as
well, what does "git status" show if you create a file in c:\gpii?

Cheers,

Tony

On Wed, Jun 7, 2017 at 4:20 PM, Steve Grundell <
[email protected]> wrote:

> Hi
>
> I think I've done something of interest to others. It's a bit of a hack,
> but I've been able to (from within the Windows VM) use npm link and keep
> the node_modules inside the VM.
>
> All I wanted to do is put links inside node_modules (links that actually
> look like links to Windows, and not have npm complain about
> node_modules/universal being a clone), and mklink doesn't work on any
> network fs I've tried.
>
> Here;s the thing:
> - Make the vagrant shared directory read-only (optional, but it feels
> good).
> - Create a directory in the VM: c:\gpii
> - Create a link to each file/directory in the source root except for
> node_modules. (in the VM I run links.bat[1] then rmdir node_modules)
> - npm install, and node_modules is created in c:\gpii on the VM drive, and
> everything else is loaded from the host (by following the symlinks).
>
> So, it's similar to how c:\vagrant links to "everything" - but it links to
> "almost everything".
>
> This feels it should work, however when you decide to run gpii.js (which
> is a symlink) it resolves to "\\vboxsvr\vagrant\gpii.js" and then
> everything else becomes relative to that (including node_modules).
>
> Fortunately, this resolving is just performed by fs.realpath/realpathSync
> so after a quick hack to force everything in "\\vboxsvr\vagrant\" to really
> resolve to "c:\gpii\" (adjust-links.js[2]), node now loads things from
> c:\gpii leaving the OS to resolve it. You just have to add a --require
> option to node:
>
> gpii-windows: node --require adjust-links.js gpii.js
> gpii-app: node_modules\electron\dist\electron.exe --require
> c:\gpii\adjust-links.js main.js
>
> I've been using this for a few weeks - forgot all about it until now (I
> "re-provision" using snapshots).
>
> Steve
>
> [1] links.bat: https://gist.github.com/stegru/
> ea0e1190bca2e02ec9255348a01232a2
> [2] adjust-links.js: https://gist.github.com/stegru/
> ec8eb3f9637e6f4d8c0619e8d0c54293
>
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> http://lists.gpii.net/mailman/listinfo/architecture
>
>
_______________________________________________
Architecture mailing list
[email protected]
http://lists.gpii.net/mailman/listinfo/architecture

Reply via email to