我似乎无法在Homestead上做任何sym链接。
在文档https://laravel.com/docs/5.6/homestead#provider-specific-settings它说
如果符号链接在Windows计算机上无法正常工作,则可能需要将以下块添加到Vagrantfile:
config.vm.provider "virtualbox" do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end
这就是我所做的,所以现在我的Vagrant文件看起来像这样:
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
if File.exist? aliasesPath then
config.vm.provision "file", source: aliasesPath, destination: "/tmp/bash_aliases"
config.vm.provision "shell" do |s|
s.inline = "awk '{ sub(\"\r$\", \"\"); print }' /tmp/bash_aliases > /home/vagrant/.bash_aliases"
end
end
if File.exist? homesteadYamlPath then
settings = YAML::load(File.read(homesteadYamlPath))
elsif File.exist? homesteadJsonPath then
settings = JSON::parse(File.read(homesteadJsonPath))
else
abort "Homestead settings file not found in #{confDir}"
end
Homestead.configure(config, settings)
if File.exist? afterScriptPath then
config.vm.provision "shell", path: afterScriptPath, privileged: false, keep_color: true
end
if Vagrant.has_plugin?('vagrant-hostsupdater')
config.hostsupdater.aliases = settings['sites'].map { |site| site['map'] }
elsif Vagrant.has_plugin?('vagrant-hostmanager')
config.hostmanager.enabled = true
config.hostmanager.manage_host = true
config.hostmanager.aliases = settings['sites'].map { |site| site['map'] }
end
config.vm.provider "virtualbox" do |v|
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root", "1"]
end
end
然而,当我做任何象征性的链接时:
touch a
ln -s a b
我收到以下错误:
ln: failed to create symbolic link 'b': Protocol error
我怎么解决这个问题?我把代码放在了错误的地方吗?
你能尝试一下:
v.customize ["setextradata", :id, "VBoxInternal2/SharedFoldersEnableSymlinksCreate/home/vagrant/code", "1"]
注意/home/vagrant/code
我相信最后一部分必须是路径。这对你有用吗?
在本地计算机上(不是ssh'd进入宅基地),转到根目录并使用git bash运行以下命令:
ln -sr a b