2

I know this has been asked many times but I can't find an answer that works for me. I'm on a Mac running macOS 10.15.6 and I'm getting the issue of Unable to locate phpcs in VSCode version 1.47.3. The actual error is:

phpcs: Unable to locate phpcs. Command failed: "/Users/mat/.composer/vendor/bin/phpcs" --version

If I run /Users/mat/.composer/vendor/bin/phpcs --version in my terminal I get the correct response and if I do which phpcs I get the desired /Users/mat/.composer/vendor/bin/phpcs.

When I switch the VSCode extension works as it should but then when I close and reopen VSCode I get the error, which is solved again if I switch extensions.

My VSCode settings are:

"phpcs.enable": true,
"php.validate.executablePath": "/Users/mat/.composer/vendor/bin/phpcs",
"phpcs.executablePath": "/Users/mat/.composer/vendor/bin/phpcs",
"phpcs.standard": "PSR12",

I've really been unable to figure out why this error keeps happening when I launch VSCode. Any help would be greatly appricated.

Thanks

Mat Teague
  • 147
  • 2
  • 3
  • 11
  • [Have you tried to put in an absolute path? That was the only way I was able to get it to work on my mac.](https://github.com/ikappas/vscode-phpcs/issues/175#issuecomment-671408874)? – zrzka Aug 12 '20 at 06:41
  • Hi @zrzka thanks for replying. I have added the path to PHPCS in my settings.json but still get the error. I've updated my question to so my settings – Mat Teague Aug 17 '20 at 16:14
  • Did you ever get to the bottom of this? I have the same issue on mac, I've copied the output of which phpcs in to the path for user config "phpcs: executable path" but it says it can't find it. – Daniel Harper Apr 27 '22 at 09:55

0 Answers0