I'm trying to set up a system to build my node js project in a reference Linux VM, while allowing the developer to work in whatever their preferred environment is (Windows, OSX, Ubuntu, whatever).
I'm having trouble with doing this on a Windows host.
My reference VM is an Ubuntu 14.04 image, provisioned using Vagrant/VirtualBox, with a shared folder containing the project source on the host machine. So, my project setup looks like this:
Host Machine:
/user/repos/my-project/ # <-- shared folder with guest VM
gulpfile.js
src/
build/
guest VM:
$HOME/repos/
my-project/ # <-- mounted shared folder from host machine
Using gulp as a build tool, source code in src and build artifacts going to build.
I can build this normally on the host machine with npm install ; gulp, but I can't build it within the host machine. I've tried a couple of different ways of doing this: building within the shared folder, and symlinking the source directories to another folder at $HOME/repos/symlinks/ and running npm install ; gulp within that. Both these approaches throw an error like so:
vagrant@vagrant-ubuntu-trusty-64:~/projbuild$ ./node_modules/gulp/bin/gulp.js
module.js:340
throw err;
^
Error: Cannot find module 'lodash._basecreate'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/vagrant/mnt/node_modules/gulp-livereload/node_modules/lodash.assign/node_modules/lodash._basecreatecallback/node_modules/http://lodash.bind/node_modules/lodash._createwrapper/node_modules/lodash._basebind/index.js:9:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
vagrant@vagrant-ubuntu-trusty-64:~/projbuild$
I can understand why this might happen if building within the shared folder, as Linux and Windows treat symlinks completely differently. However, in the setup where I'm building in a guest-only directory, with the source files symlinked, I don't see why this would be broken.
If I copy the source files out of the shared folder into the guest VM, then I can build the project normally. However, I would like to be able to run continuous incremental builds against the files on the host machine, so this solution is a little more awkward.
Anyone know what's going on here? Is what I want even possible?
Aucun commentaire:
Enregistrer un commentaire