Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

phpcs: Unable to locate phpcs, Please add phpcs to global path #14

Closed
joaomoreno opened this issue Jul 8, 2016 · 23 comments
Closed

phpcs: Unable to locate phpcs, Please add phpcs to global path #14

joaomoreno opened this issue Jul 8, 2016 · 23 comments

Comments

@joaomoreno
Copy link

@joaomoreno joaomoreno commented Jul 8, 2016

From @ritayzy on July 8, 2016 6:50

  • VSCode Version: 1.3.0 (1.3.0)
  • OS Version: 10.11.3 (15D21)
  • vs plugin: phpcs

Steps to Reproduce:

when i open a .php file, the tips show that:

image

in my termianl, i input this which phpcs, show that:

image

Someone can help me. Thanks!

Copied from original issue: microsoft/vscode#8900

@arc41t3ct
Copy link

@arc41t3ct arc41t3ct commented Jul 11, 2016

Why is this closed? There is no fix for this yet. I have the same issue but it works when I start vscode from the command line.

@lslz627
Copy link

@lslz627 lslz627 commented Jul 11, 2016

There is the same problems at eslint, I think it's bug's vscode, not phpcs
Some people have solved it? Please help me,Thanks!

@joaomoreno
Copy link
Author

@joaomoreno joaomoreno commented Jul 11, 2016

Closing as duplicate of microsoft/vscode#8434

@joaomoreno joaomoreno closed this Jul 11, 2016
@Wrenbjor
Copy link

@Wrenbjor Wrenbjor commented Dec 27, 2017

@joaomoreno This is not a dupe of microsoft/vscode#8434 Nothing in that thread fixes this issue. I am seeing the exact same problem with 1.19.1 on OSX. Is there a known fix or workaround?

@contactjavas
Copy link

@contactjavas contactjavas commented Jan 9, 2018

Im facing this problem too,
Would you mark this as open issue again @joaomoreno ?

@joaomoreno joaomoreno reopened this Jan 9, 2018
@bahmanyaghoobi
Copy link

@bahmanyaghoobi bahmanyaghoobi commented Jan 10, 2018

I have the same issue. Why is this closed?

@MrAmbiG
Copy link

@MrAmbiG MrAmbiG commented Jan 18, 2018

Installing the composer globally fixed it for me.
https://getcomposer.org/doc/00-intro.md#globally

@mobayen
Copy link

@mobayen mobayen commented Jan 18, 2018

This one worked for me:

https://stackoverflow.com/questions/47174009/visual-code-studio-unable-to-locate-phpcs

1- Go to extensions and install the plugin...."phpcs".
2- Search for the extension if you had install it.
3- Disable the extension.

@ikappas
Copy link
Owner

@ikappas ikappas commented Feb 21, 2018

I just released vscode-phpcs 1.0.0 which supports the VSCode 1.20+ and includes many enhancements most notable of which are:

  1. multi root support
  2. lint as you type support
  3. automatic configuration search support
  4. ability to set phpcs.executablePath
  5. ability to set phpcs.showWarnings
  6. ability to set phpcs.showSources
  7. ability to set phpcs.composerJsonPath to something other that workspaceRoot/composer.json
  8. ability to enable phpcs.trace.server with messages or verbose option for tracing errors.

I would like to give my thanks to all the people that helped track down issues in the previous betas and hope the new features help you get things done easier.
On that note, I am closing this issue to properly track any new issues in the new release. If you find this issue persists or any other issue please feel free to open a new ticket for v.1.0.0.

@ikappas ikappas closed this Feb 21, 2018
@cerzzwiz
Copy link

@cerzzwiz cerzzwiz commented Feb 22, 2018

Hi guys if someone still needs help about this "Unable to locate phpcs ..." error message try this: you just need to install phpcs globally via Composer.
1- Install Composer from https://getcomposer.org/download/ if you don't have it,
2- After Composer is installed, open a command prompt wherever you want and run this command =>

composer global require squizlabs/php_codesniffer

@briandrolet
Copy link

@briandrolet briandrolet commented Feb 26, 2018

thank you for the fixes @ikappas , it's very much appreciated!

@karson
Copy link

@karson karson commented Mar 14, 2018

i installed phpcs global via composer , but error persists i had to insert executable phat manually. i'm using ubuntu 16.10

@ros-financial-com
Copy link

@ros-financial-com ros-financial-com commented Mar 24, 2018

In Fedora 27, I solved the problem by installing php-pear-PHP-CodeSniffer-3.2.3-1.fc27.noarch. This should be true for RHEL, too.
I guess a similar package is available for .deb based Linuxes, too.

@kakasal
Copy link

@kakasal kakasal commented Mar 31, 2018

This is still an un-resolved issue.

@akupaka
Copy link

@akupaka akupaka commented Apr 7, 2018

I'm having the issue on macOS High Sierra.

Installed all according to instruction:

  1. Installed composer globally (Composer version 1.6.3).
  2. composer global require squizlabs/php_codesniffer.
  3. Installed phpcs VSC extension.

@oviniciusfeitosa
Copy link

@oviniciusfeitosa oviniciusfeitosa commented Apr 23, 2018

Try to follow this steps:

  • Installing globally PHPCS
composer global require squizlabs/php_codesniffer
  • Know yout $path
echo $path
  • Add line below into your ~/.zshrc ou ~/.bashrc
export PATH="/home/$USER/.config/composer/vendor/bin:$PATH"

@markfullmer
Copy link

@markfullmer markfullmer commented May 10, 2018

In your VS Code "User Settings" ("Preferences"), add:

    "phpcs.executablePath":"/path/to/phpcs"

See item 4, above, from the maintainer: #14 (comment)

@bobbyConnxus
Copy link

@bobbyConnxus bobbyConnxus commented May 25, 2018

On Ubuntu 17.10 sudo apt install php-codesniffer resolved the issue for me.

@creativestate
Copy link

@creativestate creativestate commented May 29, 2018

On Windows:

  • Install Composer
  • Install PHP_CodeSniffer via Composer using "composer global require squizlabs/php_codesniffer" in the command prompt for a system wide install

Details are listed on the https://marketplace.visualstudio.com/items?itemName=ikappas.phpcs page.

@goseesomething
Copy link

@goseesomething goseesomething commented Jul 1, 2018

I have the same problem but using the method offered by cerzzwiz then the error message never come again~

@rgfpy
Copy link

@rgfpy rgfpy commented Nov 2, 2018

In Windows i added these lines config:

"phpcs.enable": true,
"phpcs.autoConfigSearch": true,
//comment or remove the item "phpcs.executablePath": "",
"php.validate.executablePath": "C:/wamp64/bin/php/php7.0.32/php.exe",

@eGirlAsm
Copy link

@eGirlAsm eGirlAsm commented Feb 15, 2019

in user workspace setting(not user setting)
"phpcs.executablePath": "/Users/egirlasm/.composer/vendor/bin/phpcs"
finally must be add phpcs in the end

@jel111
Copy link

@jel111 jel111 commented Mar 8, 2019

I have tried all the above but things didn't work until I went into settings and added the actual path to the:
Executable Path - Optional. The path to the phpcs executable.
Mine happens to : /Users/macuser/vendor/squizlabs/php_codesniffer/bin

I don't know why because I ran the command to change this as described above but that didn't happen. Let me know what I did wrong here, please. If you need more info let me know. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet