【发布时间】:2018-03-17 18:16:15
【问题描述】:
我似乎无法在 Homestead 上创建任何符号链接。
在文档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
我该如何解决这个问题? 我是不是把代码放错地方了?
【问题讨论】:
-
对我来说,以管理员身份运行是不够的,我在尝试创建符号链接时仍然遇到“协议错误”。这是有效的:stackoverflow.com/a/60741351/470749