在~/. composer/vendor/laravel/valet/server. php中权限被拒绝

jjjwad0x  于 2023-06-04  发布在  PHP
关注(0)|答案(2)|浏览(255)

我突然遇到了Laravel Valet的问题:

Warning: file_get_contents(/Users/Myself/.config/valet/config.json): failed to open stream: Permission denied in /Users/Myself/.composer/vendor/laravel/valet/server.php on line 60

Warning: Invalid argument supplied for foreach() in /Users/Myself/.composer/vendor/laravel/valet/server.php on line 86
404 - Not Found

我尝试了这个常见的解决方案:

sudo chown -R $(whoami) ~/.composer/vendor

我也试过:

sudo chown -R $(whoami) /Users/Myself/.config/valet/config.json

最后,我确保composer路径在我的.zshrc文件中:

export PATH="$PATH:$HOME/.composer/vendor/bin"

我尝试删除.config/valet/config.json文件并重新创建它。
已尝试全局更新composer、运行brew doctor并重新启动valet。
尝试了brew remove composer,然后是brew install composer
已尝试chmod 0777 ~/.config/valet/config.json并获得这些权限,但仍然出现相同的错误:

Access: (0777/-rwxrwxrwx)  Uid: (  501/    Myself)   Gid: (   70/    _www)

我该怎么解决?

eiee3dmh

eiee3dmh1#

这一系列命令修复了问题:

  1. brew uninstall composer
  2. rm -rf ~/.composer
  3. valet uninstall
  4. rm -rf ~/.config/valet
  5. valet unsecure --all
  6. brew update
  7. brew install composer
  8. composer global require laravel/valet
  9. valet install
  10. valet park(在站点目录中)
  11. valet secure(在存储库目录中)
kuuvgm7e

kuuvgm7e2#

我在当地也遇到了同样的问题。
我用正确的.valet/config.json路径更改了~/.composer/vendor/laravel/valet/server.php文件VALET_HOME_PATH变量值。那它运行得很好。
参考链接:https://laracasts.com/discuss/channels/general-discussion/getting-valet-not-found-error?page=1&replyId=166071

相关问题