benmatselby / sublime-phpcs

🔍 PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text
Other
812 stars 126 forks source link

Doesn't work on my windows 10 #190

Closed jeraldpunx closed 1 year ago

jeraldpunx commented 5 years ago

Error after executing SNIFF THIS FILE

Traceback (most recent call last):
  File "./python3.3/subprocess.py", line 1104, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "D:\Program Files\Sublime Text 3\sublime_plugin.py", line 1088, in run_
    return self.run(edit)
  File "C:\Users\JeraldPunx\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 661, in run
  File "C:\Users\JeraldPunx\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 479, in run
  File "C:\Users\JeraldPunx\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 149, in get_errors
  File "C:\Users\JeraldPunx\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 231, in execute
  File "C:\Users\JeraldPunx\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 234, in parse_report
  File "C:\Users\JeraldPunx\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 176, in shell_out
  File "./python3.3/subprocess.py", line 819, in __init__
  File "./python3.3/subprocess.py", line 1110, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
jeraldpunx commented 5 years ago

This is my config, image

image

benjivm commented 4 years ago

On Windows you need to reference the .bat files in your config. Also if those are in your PATH you can drop the path, e.g., in my config I have:

"php_cs_fixer_executable_path": "php-cs-fixer.bat",
Micu22 commented 3 years ago

I have the same issue. This is not working:

{
    "show_debug": true,
        //phpcs.bat not working, AND phpcs (without .bat) not working
    "phpcs_executable_path": "/c/Users/micha/AppData/Roaming/Composer/vendor/bin/phpcs.bat",
    "phpcs_additional_args": {
        "--standard": "WordPress",
        "-n": ""
    }
}

nor this:

{
    "show_debug": true,
        //phpcs.bat not working, AND phpcs (without .bat) not working
    "phpcs_executable_path": "/Users/micha/AppData/Roaming/Composer/vendor/bin/phpcs",
    "phpcs_additional_args": {
        "--standard": "WordPress",
        "-n": ""
    }
}

Using phpcs from command line works without problems.

Debug info: [Phpcs] /c/Users/micha/AppData/Roaming/Composer/vendor/bin/phpcs.bat --report=checkstyle -n --standard=WordPress C:\Apache24\htdocs\wp-content\themes\mike\404.php [Phpcs] /c/Users/micha/AppData/Roaming/Composer/vendor/bin/phpcs.bat --report=checkstyle -n --standard=WordPress C:\Apache24\htdocs\wp-content\themes\mike\404.php [Phpcs] cwd: C:\Apache24\htdocs\wp-content\themes\mike Traceback (most recent call last): File "./python3.3/subprocess.py", line 1104, in _execute_child FileNotFoundError: [WinError 2] The system cannot find the file specified

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublimeplugin.py", line 1088, in run return self.run(edit) File "C:\Users\micha\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 661, in run File "C:\Users\micha\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 479, in run File "C:\Users\micha\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 149, in get_errors File "C:\Users\micha\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 231, in execute File "C:\Users\micha\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 234, in parse_report File "C:\Users\micha\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package\phpcs.py", line 176, in shellout File "./python3.3/subprocess.py", line 819, in __init_\ File "./python3.3/subprocess.py", line 1110, in _execute_child FileNotFoundError: [WinError 2] The system cannot find the file specified

pablo-sg-pacheco commented 3 years ago

Doesn't work for me too, same problem :(

valentinoPereira commented 3 years ago

I'm facing the same issue..

benmatselby commented 3 years ago

Hey folks. Apologies. I don't use PHP or Sublime anymore (Nor do I have a Windows machine), so realistically I'm not going to be able to get to look this. I think there are other php linters in the Sublime ecosystem, hopefully they meet your needs.

code05-hello commented 1 year ago

Hi, I have made it working after few minutes of R&D phew Step1 is to download all the .phar files, and move them to your /usr/local/bin folder, and make sure, you give them 777 permission to these files.

After that open a new terminal session, and try to type phpcs.phar, and if it works, then do following as below : Below is the settings you have to use on sublime-text 4 user settings file of the phpcs package.


If it does not work, then add below settings
First download all the .phar from the websites, and then in the settings 

{
    "phpcs_php_path": "/usr/local/opt/php@7.4/bin/php",
    "phpcs_executable_path": "/usr/local/bin/phpcs.phar",
    "phpcbf_executable_path":"/usr/local/bin/phpcbf.phar",
    "phpmd_executable_path":"/usr/local/bin/phpmd.phar",
}
benmatselby commented 1 year ago

Hey folks. Closing this issue down with the fix from @code05-hello