benmatselby / sublime-phpcs

šŸ” PHP CodeSniffer, PHP Coding Standard Fixer, Linter, and Mess Detector Support for Sublime Text
Other
811 stars 127 forks source link

Installed on Windows sublime 3 - Not working #178

Open oakbani opened 7 years ago

oakbani commented 7 years ago

Here is the error message on command pallete when I try to sniff some 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 "C:\Program Files\Sublime Text 3\sublimeplugin.py", line 818, in run return self.run(edit) File "phpcs in C:\Users\oakbani\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 661, in run File "phpcs in C:\Users\oakbani\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 479, in run File "phpcs in C:\Users\oakbani\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 149, in get_errors File "phpcs in C:\Users\oakbani\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 231, in execute File "phpcs in C:\Users\oakbani\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", line 234, in parse_report File "phpcs in C:\Users\oakbani\AppData\Roaming\Sublime Text 3\Installed Packages\Phpcs.sublime-package", 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

MrKarlDilkington commented 7 years ago

I am experiencing the same issue.

benmatselby commented 7 years ago

Hi @oakbani

I don't have access to a windows machine, which makes supporting this a tad tricky. Could you post the output from the console when debug=true please and also paste in your settings in here please.

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

benmatselby commented 11 months ago

Hey @oakbani @MrKarlDilkington Are you both having this issue still?

Can you confirm that those files exist on your filesystem, and that they have executable permissions? Also, depending on what PHP version you have, you may need to define phpcs_php_prefix_path and phpcs_commands_to_php_prefix.

The comment for those settings are:

  // The path to the php executable.
  // Needed for windows, or anyone who doesn't/can't make phars
  // executable. Avoid setting this if at all possible

and

  // Options include:
  // - Sniffer
  // - Fixer
  // - MessDetector
  // - CodeBeautifier
  //
  // This will prepend the application with the path to php
  // Needed for windows, or anyone who doesn't/can't make phars
  // executable. Avoid setting this if at all possible

This may help.

oakbani commented 11 months ago

Can't comment. I haven't tried it for years. And Can't test since I have moved from windows. Thanks

On Sun, 15 Oct 2023, 20:33 Ben Selby, @.***> wrote:

Hey @oakbani https://github.com/oakbani @MrKarlDilkington https://github.com/MrKarlDilkington Are you both having this issue still?

Can you confirm that those files exist on your filesystem, and that they have executable permissions? Also, depending on what PHP version you have, you may need to define phpcs_php_prefix_path and phpcs_commands_to_php_prefix.

The comment for those settings are:

// The path to the php executable. // Needed for windows, or anyone who doesn't/can't make phars // executable. Avoid setting this if at all possible

and

// Options include: // - Sniffer // - Fixer // - MessDetector // - CodeBeautifier // // This will prepend the application with the path to php // Needed for windows, or anyone who doesn't/can't make phars // executable. Avoid setting this if at all possible

This may help.

ā€” Reply to this email directly, view it on GitHub https://github.com/benmatselby/sublime-phpcs/issues/178#issuecomment-1763425641, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADME472NFG35ANFI4BBANKTX7P65JANCNFSM4DUTYFLQ . You are receiving this because you were mentioned.Message ID: @.***>