寻找什么额外的configuration,我可以设置允许我的Ubuntu的virtualbox虚拟机写入我的OSX主机上的NFS同步的项目目录的帮助。 我已经在macOS中为vagrant设置了显式sudoers,所以如果需要的话,它不应该有修改主机的任何问题。
最终目标是能够在ubuntu中操作应用程序的构build和开发运行时,同时编辑macOS主机上的文件,并且Ubuntu机器将检测到变化并根据需要用gulp进行重build。
目前在npm install bcrypt时会出现错误,当它试图保留权限的时候,但是我也不确定这是否是完全失败的root cuase。
交叉发布: https : //groups.google.com/forum/#!topic/ vagrant-up/ LS_eFJhZAwQ
Vagrantfile:
Vagrant.configure(2) do |config| config.vm.box = "ubuntu/xenial64" config.vm.provider "virtualbox" do |v| v.memory = "3072" v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"] end config.vm.define "dev", primary: true do |dev| dev.vm.hostname = "proteus.dev" dev.vm.network "private_network", ip: "192.168.10.10" dev.vm.synced_folder '.', '/home/ubuntu/src/proteus', nfs: true, mount_options:['nolock,vers=3,udp,noatime,actimeo=1'] # also tried 'rw' and other linux__mount_options end end
错误输出:
$ npm install bcrypt > [email protected] install /home/ubuntu/src/proteus/node_modules/bcrypt > node-pre-gyp install --fallback-to-build node-pre-gyp ERR! Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v1.0.2/bcrypt_lib-v1.0.2-node-v48-linux-x64.tar.gz node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp) make: Entering directory '/home/ubuntu/src/proteus/node_modules/bcrypt/build' CXX(target) Release/obj.target/bcrypt_lib/src/blowfish.o CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt.o CXX(target) Release/obj.target/bcrypt_lib/src/bcrypt_node.o SOLINK_MODULE(target) Release/obj.target/bcrypt_lib.node COPY Release/bcrypt_lib.node cp: preserving permissions for 'Release/bcrypt_lib.node': Operation not permitted bcrypt_lib.target.mk:134: recipe for target 'Release/bcrypt_lib.node' failed make: *** [Release/bcrypt_lib.node] Error 1 make: Leaving directory '/home/ubuntu/src/proteus/node_modules/bcrypt/build' gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:258:23) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Linux 4.4.0-83-generic gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/ubuntu/src/proteus/node_modules/bcrypt/lib/binding/bcrypt_lib.node" "--module_name=bcrypt_lib" "--module_path=/home/ubuntu/src/proteus/node_modules/bcrypt/lib/binding" gyp ERR! cwd /home/ubuntu/src/proteus/node_modules/bcrypt gyp ERR! node -v v6.11.0 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok node-pre-gyp ERR! build error node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ubuntu/src/proteus/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/ubuntu/src/proteus/node_modules/bcrypt/lib/binding' (1) node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/ubuntu/src/proteus/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at emitTwo (events.js:106:13) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:891:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5) node-pre-gyp ERR! System Linux 4.4.0-83-generic node-pre-gyp ERR! command "/usr/bin/nodejs" "/home/ubuntu/src/proteus/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /home/ubuntu/src/proteus/node_modules/bcrypt node-pre-gyp ERR! node -v v6.11.0 node-pre-gyp ERR! node-pre-gyp -v v0.6.32 node-pre-gyp ERR! not ok Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/ubuntu/src/proteus/node_modules/bcrypt/lib/binding/bcrypt_lib.node --module_name=bcrypt_lib --module_path=/home/ubuntu/src/proteus/node_modules/bcrypt/lib/binding' (1) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) npm ERR! Linux 4.4.0-83-generic npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "bcrypt" npm ERR! node v6.11.0 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE
我曾经有一个类似的问题。 尝试在MacOS中清空/etc/exports 。 我没有mount_options或setextradata 。
我会首先尝试隔离问题,首先看看为什么cp不工作(没有npm的东西)。 这可能是macOS问题,我仍然有https://github.com/mitchellh/vagrant/issues/8061
祝你好运!