Fresh Homestead在Windows上不起作用(拒绝合成器重命名权限错误)

时间:2019-01-29 17:20:44

标签: laravel homestead

我正在Windows上运行Homestead v8.0.1的新版本。

我的Homestead.yml文件看起来像这样:

---
ip: "192.168.99.20"
memory: 2048
cpus: 1
provider: virtualbox

backup: true

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/Documents/example
      to: /home/vagrant/code/dealer-app

sites:
    - map: example.test
      to: /home/vagrant/code/example/public
      type: "apache"

databases:
    - example

ports:
    - send: 4200
      to: 4200
    - send: 49153
      to: 49153

我做了以下事情:

$ git clone https://github.com/laravel/homestead.git .
$ git checkout v8.0.1
$ init.bat
$ vagrant up

在我收到此错误之前,大多数方法都有效:

homestead-7: Running: script: Update Composer
homestead-7: Updating to version 1.8.2 (stable channel).
homestead-7:
homestead-7:
homestead-7:   [ErrorException]
homestead-7:   rename(/home/vagrant/.composer/cache/composer-temp.phar,/usr/local/bin/composer): Permission denied

为什么这不起作用?

homestead.rb,它具有:

 config.vm.provision 'shell' do |s|
      s.name = 'Update Composer'
      s.inline = 'sudo -u vagrant /usr/local/bin/composer self-update --no-progress && sudo chown -R vagrant:vagrant /home/vagrant/.composer/'
      s.privileged = false
  end

那么在Windows版本的Vagrant上运行chown可能是个问题吗?

更新

我设法通过将homestead.rb作曲家部分编辑为:

config.vm.provision 'shell' do |s|
  s.name = 'Update Composer'
  s.inline = '/usr/local/bin/composer self-update --no-progress && chown -R vagrant:vagrant /home/vagrant/.composer/'
  s.privileged = true
  # s.inline = 'sudo -u vagrant /usr/local/bin/composer self-update --no-progress && sudo chown -R vagrant:vagrant /home/vagrant/.composer/'
  # s.privileged = false
end

这是正确的吗?这是一个宅基虫吗?

2 个答案:

答案 0 :(得分:5)

这是v8.0.2。中修复的Homestead bug

Updating升级到最新版本应该可以解决该问题。

注意:请确保您运行的是git checkout v8.0.2,而不是文档现在所说的git checkout v8.0.1

答案 1 :(得分:0)

这不是通常的设置过程。

我建议遵循指南here

运行init.bat之后,应先设置homestead.yaml文件,然后再运行流浪汉。