我正在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


这样对吗?这是一个宅基虫吗?

最佳答案

这是v8.0.2中修复的Homestead bug

Updating到最新版本应该修复它。

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

关于laravel - Fresh Homestead无法在Windows上运行(编写器重命名权限被拒绝的错误),我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/54426417/

10-13 01:34