0

I'm getting this issue with Laravel Valet suddenly:

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

I tried this common solution:

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

I also tried:

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

Lastly I made sure the composer path is in my .zshrc file:

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

I tried deleting the .config/valet/config.json file and recreating it.

Tried updating composer globally, running brew doctor, and restarting valet.

Tried brew remove composer followed by brew install composer.

Tried chmod 0777 ~/.config/valet/config.json and got these permissions but still have the same error:

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

How do I fix this?

eComEvo
  • 11,669
  • 26
  • 89
  • 145

2 Answers2

1

This series of commands fixed the issue:

  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 (on site dir)
  11. valet secure (in repo dir)
eComEvo
  • 11,669
  • 26
  • 89
  • 145
  • I don't think these steps are in the right order. How do you run `valet` AFTER removing ~/.composer ..? That said, I merely deleted the valet config directory, re-initialized it with `valet install` and that did it. It was probably a PHP config issue stemming from a `brew upgrade` I ran a few days ago. – InanisAtheos Aug 22 '22 at 19:51
0

I faced the same issue in my local too.

I changed the ~/.composer/vendor/laravel/valet/server.php file VALET_HOME_PATH variable value with the correct .valet/config.json path. Then it's working well.

Reference link: https://laracasts.com/discuss/channels/general-discussion/getting-valet-not-found-error?page=1&replyId=166071

Jai Kumaresh
  • 715
  • 1
  • 7
  • 33