Vagrant xenial64 NFS 同步目录“保留权限”在 bcrypt 构建时失败

Vagrant xenial64 NFS 同步目录“保留权限”在 bcrypt 构建时失败

寻求帮助,了解我可以设置哪些额外配置以允许我的 ubuntu virtualbox vm 写入 OSX 主机上的 NFS 同步项目目录。我已经在 macOS 中为 vagrant 设置了显式 sudoers,因此如果需要修改主机应该不会有任何问题。

最终目标是能够在 ubuntu 中操作应用程序的构建和开发运行时,同时编辑 macOS 主机上的文件,ubuntu 框将检测更改并根据需要使用 gulp 重建。

npm install目前,当 bcrypt 尝试保留权限时会出现错误,但我也不确定这是否是导致完全失败的根本原因。

交叉发布:https://groups.google.com/forum/#!topic/vagrant-up/LS_eFJhZAwQ

Vagrant文​​件:

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

答案1

我曾经遇到过类似的问题。尝试清空你/etc/exports的 MacOS。我没有mount_optionssetextradata

我会先尝试隔离问题,先看看为什么cp不起作用(没有 npm 的东西)。可能是 macOS 的问题,我仍然有https://github.com/mitchellh/vagrant/issues/8061

祝你好运!

相关内容