sublime-phpcs icon indicating copy to clipboard operation
sublime-phpcs copied to clipboard

Doesn't work on my windows 10

Open jeraldpunx opened this issue 6 years ago • 6 comments

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 avatar Apr 29 '19 11:04 jeraldpunx

This is my config, image

image

jeraldpunx avatar Apr 29 '19 11:04 jeraldpunx

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",

benjivm avatar Jan 24 '20 16:01 benjivm

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\sublime_plugin.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 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

Micu22 avatar Nov 22 '20 19:11 Micu22

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

pablo-sg-pacheco avatar May 31 '21 14:05 pablo-sg-pacheco

I'm facing the same issue..

valentinoPereira avatar Jul 05 '21 07:07 valentinoPereira

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.

benmatselby avatar Jul 05 '21 07:07 benmatselby

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/[email protected]/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",
}






code05-hello avatar Aug 27 '23 08:08 code05-hello

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

benmatselby avatar Oct 14 '23 19:10 benmatselby