3

My configuration / steps to reproduce the error:

  1. Installed Visual Studio Code Version 1.22.1
  2. Installed PHP CS Fixer Globally by: composer global require friendsofphp/php-cs-fixer
  3. Added Environment Variable: C:\Users\khalil\AppData\Roaming\Composer\vendor\bin\php-cs-fixer
  4. Verified running following command (php-cs-fixer). Output: Version: PHP CS Fixer 2.11.1 Grey Devil by Fabien Potencier and Dariusz Ruminski
  5. Installed Extension for vs-code: php cs fixer

Still getting the error: PHP CS Fixer: spawn php-cs-fixer ENOENT. executablePath not found

Note: I am on Windows 10 64bit

2 Answers 2

1

This is what worked out for me on Windows 10, modify if you have different folder structure.

"phpcbf.executablePath": "C:\\Users\\User\\AppData\\Roaming\\Composer\\vendor\\bin\\phpcbf.bat",
"phpcbf.executablePathWindows": "C:\\Users\\User\\AppData\\Roaming\\Composer\\vendor\\bin\\phpcbf.bat"

I am using phpcbf extension but yours is probably something like

"php-cs-fixer.executablePath": "C:\\Users\\User\\AppData\\Roaming\\Composer\\vendor\\bin\\php-cs-fixer.phar",
"php-cs-fixer.executablePathWindows": "C:\\Users\\User\\AppData\\Roaming\\Composer\\vendor\\bin\\php-cs-fixer.bat",
Sign up to request clarification or add additional context in comments.

2 Comments

Getting the same error and none of the answers here have helped me. Do you have any other ideas? Been on this for days. Thanks in advance.
Update: ended up having to run some composer command (this wasy days ago so I forgot sadly) and my composer.json was updated as well as setting the phpsab.standard in settings.json, and installing the valeryanm.vscode-phpsab extension instead.
0

With Windows 10 & VS Code, You can use:

  1. Install Composer global & see: https://github.com/FriendsOfPHP/PHP-CS-Fixer#installation

  2. Add C:\Users{My Username}\AppData\Roaming\Composer\vendor\bin to PATH in System environment

  3. Use config:

    "php-cs-fixer.executablePath": "php-cs-fixer",

    "php-cs-fixer.executablePathWindows": "php-cs-fixer.bat",

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.