流浪者共享文件夹“ npm install”失败。 “文本文件正忙,重命名...”

时间:2018-09-22 15:25:48

标签: npm vagrant

我有Windows 10 pro,它是我的主机,并且正在Windows中构建以下无业游民的机器:

  config.vm.box = "ubuntu/xenial64"
  config.vm.synced_folder "../", "/vagrant", type: "nfs"
  config.vm.network "forwarded_port", guest: 3000, host: 3000

  config.vm.provider "virtualbox" do |v|
    # Enable symlinks in vagrant shared folder, https://coderwall.com/p/b5mu2w
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant-root", "1"]
    v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/vagrant", "1"]
  end

在机器内部运行npm install时出现以下错误:

npm ERR! path /vagrant/hlf-http-api/node_modules/abbrev/package.json.610637167 npm ERR! code ETXTBSY npm ERR! errno -26 npm ERR! syscall rename npm ERR! ETXTBSY: text file is busy, rename '/vagrant/hlf-http-api/node_modules/abbrev/package.json.610637167' -> '/vagrant/hlf-http-api/node_modules/abbrev/package.json'

当我从Windows运行此命令时,它运行完美。

谢谢

1 个答案:

答案 0 :(得分:0)

我正在面对这个问题,即使以Admin身份启动Vagrant也无法解决问题,因此这似乎不是Symlink的问题,因为我能够以Admin身份打开它时可以创建符号链接

问题似乎可能是扩展名长度?不确定

但是我发现的解决方案是:https://kawadev.net/vagrant-npm-install-error/

TL; DR:

vagrant plugin install vagrant-winnfsd
vagrant plugin update

并更改

config.vm.synced_folder "./vue-develop", "/vue-develop"
   ↓
config.vm.synced_folder "./vue-develop", "/vue-develop", type: "nfs"

重新装箱

vagrant reload

要安装,无论如何都要使用--no-bin-links,因为我在没有管理员的情况下运行时遇到错误

npm install --no-bin-links