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 seem to work in Sublime Text 3 for Windows #89

Closed chrismatta closed 11 years ago

chrismatta commented 11 years ago

Getting the following error in the console of sublime text 3 on Win 7:

Traceback (most recent call last):
  File "X/subprocess.py", line 1090, 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 549, in run_
    return self.run(edit)
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 551, in run
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 389, in run
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 128, in get_errors
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 194, in execute
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 197, in parse_report
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 149, in shell_out
  File "X/subprocess.py", line 818, in __init__
  File "X/subprocess.py", line 1096, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
benmatselby commented 11 years ago

Looks to be same kind of error as : https://github.com/benmatselby/sublime-phpcs/issues/87

Can you read through the comments on there please, as see if that helps.

chrismatta commented 11 years ago

Here's my phpcs.sublime-settings file (User settings):

{
    "phpcs_php_prefix_path": "",
    "phpcs_php_path": "C:\\Program Files (x86)\\PHP\\php.exe"
}

and I do have the php directory in my path, but I'm still getting the above error.

Is this an error where the plugin interpreter can't find the php executable?

benmatselby commented 11 years ago

Can you turn on the debug option and run it again and then copy the output which will include the shell commands being executed. It's hard to tell the issue without seeing what is being shelled out to the terminal.

chrismatta commented 11 years ago

Seems like it's generating an error after checking the file:

[Phpcs] C:\Program Files (x86)\PHP\php.exe -l -d display_errors=On C:\Users\a150495\ssp\application\models\DbTable\InvZfsReplication.php
[Phpcs] cwd: C:\Users\a150495
[Phpcs] No syntax errors detected in C:\Users\a150495\ssp\application\models\DbTable\InvZfsReplication.php

[Phpcs] phpcs --report=checkstyle --standard=PEAR -n C:\Users\a150495\ssp\application\models\DbTable\InvZfsReplication.php
[Phpcs] cwd: C:\Users\a150495
Traceback (most recent call last):
  File "X/subprocess.py", line 1090, 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 549, in run_
    return self.run(edit)
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 551, in run
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 389, in run
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 128, in get_errors
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 194, in execute
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 197, in parse_report
  File "phpcs in C:\Users\a150495\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 149, in shell_out
  File "X/subprocess.py", line 818, in __init__
  File "X/subprocess.py", line 1096, in _execute_child
FileNotFoundError: [WinError 2] The system cannot find the file specified
benmatselby commented 11 years ago

Yep, it's the same #87

Either update the windows PATH so it knows where phpcs is, or specify the full path to phpcs in phpcs_executable_path

{ "phpcs_executable_path": "C:\Program Files (x86)\PHP\another directory\to\phpcs\folder", }

See an example here:

https://github.com/benmatselby/sublime-phpcs/blob/master/example-settings/windows-7-phpcs-fixer-linter.example

benmatselby commented 11 years ago

Have you resolved this issue?

chrismatta commented 11 years ago

Yes, just had to install phpcs properly, thanks Ben.

numediaweb commented 10 years ago

@benmatselby you mean also; phpcs_php_path

yosets commented 9 years ago

i have the same problem but i cant edit the file :( Help me please

benmatselby commented 9 years ago

Hi @yosets - Why file can you not edit? The config, if so you need to go to the user settings

mmcintyre123 commented 9 years ago

I'm on Windows 7 in ST3, and I'm getting these errors only with the package GitGutter installed. It seems like GitGutter used to work, but since I uninstalled Cygwin it's not working anymore and I'm getting the errors very similar to the above. If I uninstall GitGutter, I don't have any problems.

The following errors appear in the console whenever I open any file in my repository:

Traceback (most recent call last): File "./subprocess.py", line 1112, 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 535, in run return self.run() File "git_gutter in C:\Users\Matthew\AppData\Roaming\Sublime Text 3\Installed Packages\GitGutter.sublime-package", line 32, in run File "view_collection in C:\Users\Matthew\AppData\Roaming\Sublime Text 3\Installed Packages\GitGutter.sublime-package", line 55, in untracked File "git_gutter_handler in C:\Users\Matthew\AppData\Roaming\Sublime Text 3\Installed Packages\GitGutter.sublime-package", line 180, in untracked File "git_gutter_handler in C:\Users\Matthew\AppData\Roaming\Sublime Text 3\Installed Packages\GitGutter.sublime-package", line 196, in handle_files File "git_gutter_handler in C:\Users\Matthew\AppData\Roaming\Sublime Text 3\Installed Packages\GitGutter.sublime-package", line 261, in run_command File "./subprocess.py", line 824, in init File "./subprocess.py", line 1118, in _execute_child FileNotFoundError: [WinError 2] The system cannot find the file specified Traceback (most recent call last): File "./subprocess.py", line 1112, in _execute_child FileNotFoundError: [WinError 2] The system cannot find the file specified

Trying to fix this I've done....

-All the options in this thread. -Carefully went through https://github.com/benmatselby/sublime-phpcs/issues/87, -installed php 5.3.5 via http://www.microsoft.com/web/platform/phponwindows.aspx -did pear install PHP_CodeSniffer-2.3.3

-installed packages via Package Control: SublimeLinter PHPCS

Added values to path, restarted ST3 multiple times, but I still see the error... I'm at a loss... if anyone can see what's wrong I'd greatly appreciate your help!

Thanks.

mmcintyre123 commented 9 years ago

Nevermind, I fixed it :) git.exe was not in my PATH variable, since it used to be associated with Cygwin. DOH :) I hope this helps if anyone has the same problem. I added C:\Program Files (x86)\Git\bin to both local and system PATHs.