Visual Studio Code: Unable to locate phpcs

后端 未结 15 1842
梦毁少年i
梦毁少年i 2021-02-01 01:56

I am facing this issue in Visual Studio Code. I have already tried reinstalling the phpcs extension but still facing this issue.

Unable to locat

相关标签:
15条回答
  • 2021-02-01 02:02
    "phpcs.standard": "PSR2",
    "phpcs.enable": true,
    "phpcs.executablePath": "/home/<username>/.config/composer/vendor/squizlabs/php_codesniffer/bin/phpcs",
    "phpcs.autoConfigSearch": true
    
    0 讨论(0)
  • 2021-02-01 02:05

    On Debian based systems run as root:

    apt-get install php-codesniffer
    
    0 讨论(0)
  • 2021-02-01 02:07

    I had the same problem and i did this to fix it in my windows:

    1. You will Download the Composer (From here)

    2. Go to Vs code and open your terminal and run this command

      composer global require squizlabs/php_codesniffer
      
    3. Go to (settings--> User Settings), then search PHP CodeSniffer

    4. Scroll to Executatble Path and type

      \Users\{user_name}\AppData\Roaming\Composer\vendor\bin\phpcs
      

      and restart VS code.

    This works For me, I hope it Works for you too :D

    0 讨论(0)
  • 2021-02-01 02:12

    I think uninstalling it does not solve the issue.

    i had the same issue. So,

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

    it resolved the issue in my VS code.

    0 讨论(0)
  • 2021-02-01 02:12

    You stated that you already uninstalled it, so i'm assuming your trying to get rid of the extension and error.

    How to fix:

    1. Uninstall extension.
    2. Delete the entire phpcs folder from the VS Code folder.

    From the VS Code Docs:

    Q: Where are extensions installed?

    A: Depending on your platform, the global location is in the following folders:

    Windows %USERPROFILE%\.vscode\extensions
    
    Mac ~/.vscode/extensions
    
    Linux ~/.vscode/extensions
    
    0 讨论(0)
  • 2021-02-01 02:13

    I had the same problem with Drupal, the solutions is specify coding standards. So create phpcs.xml and enable the next options.

    0 讨论(0)
提交回复
热议问题