gpt4 book ai didi

laravel - Fresh Homestead 无法在 Windows 上运行( Composer 重命名权限被拒绝错误)

转载 作者:行者123 更新时间:2023-12-02 21:28:24 26 4
gpt4 key购买 nike

我正在 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 Composer 部分编辑为:

成功解决了这个问题
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

这是正确的吗?这是家园错误吗?

最佳答案

这是一个家园bug在 v8.0.2 中已修复。

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

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

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

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com