0
我跑碼頭工人集裝箱流浪VM內(與VBOX 5.0.10爲供應商),這裏是我的Vagrantfile:不能放浪同步文件夾內訪問文件
Vagrant.configure(2) do |config|
config.ssh.insert_key = false
config.vm.box = "ubuntu/trusty64"
config.vm.box_check_update = false
config.vm.network "forwarded_port", guest: 80, host: 8585
config.vm.provider "virtualbox" do |vb|
vb.cpus = 2
end
config.ssh.shell = "bash -c 'BASH_ENV=/etc/profile exec bash'"
config.vm.provision "shell", inline: <<-SHELL
sudo apt-get update
SHELL
#Docker
config.vm.provision "docker" do |d|
#d.build_image "/vagrant/app"
end
#Docker-compose
config.vm.provision :docker_compose, yml: "/vagrant/project/web-project/docker-compose.yml", rebuild: true, run: "always"
end
我在/遊民節點模塊/ project/web-project/node_modules由npm install生成的文件夾。 幾乎所有的文件和文件夾內node_modules文件夾都可以訪問,除了這個文件夾:
/vagrant/project/web-despatch/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-es2015-block-scoping/
node_modules/babel-traverse/node_modules/babel-code-frame/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js
的錯誤是:
OSError: [Errno 2] No such file or directory: '/vagrant/project/web-project/nod
e_modules/babel-preset-es2015/node_modules/babel-plugin-transform-es2015-block-s
coping/node_modules/babel-traverse/node_modules/babel-code-frame/node_modules/ch
alk/node_modules/has-ansi/node_modules/ansi-regex/index.js'
然後,我繼續通過SSH的流浪漢登錄找出問題:
[email protected] /cygdrive/d/OS/vweb-project
$ vagrant.exe ssh #yes_I'm_using_cygwin
現在我在流浪漢VM裏面,我去了裏面找不到文件的文件夾:
[email protected]:~$ cd /vagrant/project/web-project/node_modules/babel-preset-es2015/node_modules/babel-plugin-transform-es2015-block-sc
oping/node_modules/babel-traverse/node_modules/babel-code-frame/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/
然後我嘗試ls
,結果是這樣的:
node_modules/babel-traverse/node_modules/babel-code-frame/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex$ ls
ls: cannot access index.js: No such file or directory
ls: cannot access license: No such file or directory
ls: cannot access package.json: No such file or directory
ls: cannot access readme.md: No such file or directory
index.js license package.json readme.md
任何人都可以幫我解決這個問題?
謝謝
這可能是與[長路徑名]的問題(https://github.com/mitchellh/vagrant/issues/1953)在Windows和VirtualBox上。 – yjwong
通過使用https://docs.vagrantup.com/v2/synced-folders/rsync.html解決了該問題 –