AtomLinter / linter-phpcs

Linter plugin for PHP, using PHP_CodeSniffer.
63 stars 31 forks source link

spawn phpcs ENOENT #34

Closed fangspeen closed 9 years ago

fangspeen commented 9 years ago

spawn phpcs ENOENT Error: spawn phpcs ENOENT at exports._errnoException (util.js:734:11) at Process.ChildProcess._handle.onexit (child_process.js:1035:32) at child_process.js:1127:20 at process._tickCallback (node.js:357:13)

I get this error or variations of it when I alter the executable path I have checked and rechecked the path...

steelbrain commented 9 years ago

From the error message, it seems that it's using the default path. Can you try putting phpcs binary in /usr/bin/?

Dgame commented 9 years ago

I get the same error on Windows 8.1. What can I do?

Dgame commented 9 years ago

Ok, the solution is simple: you have to set this as executablePath: C:\xampp\php\phpcs.bat

steelbrain commented 9 years ago

Glad you found the fix.

jonnybarnes commented 9 years ago

I get this exact error message on Linux. Here’s my config.cson:

"*":
  welcome:
    showOnStartup: false
  linter: {}
  "linter-php":
    phpExcecutablePath: "/usr/bin/php"
  "linter-phpcs":
    phpcsExecutablePath: "/home/jonny/.composer/vendor/bin/phpcs"
    ignore: "*.blade.php,*.twig.php"
  "linter-phpmd":
    phpmdExecutablePath: "/home/jonny/.composer/vendor/bin/phpmd"
    rulesets: "cleancode,codesize,controversial,design,naming,unusedcode,laravel"
  core: {}
  editor:
    invisibles: {}

Indeed opening a terminal and typing in phpcs --version works given /home/jonny/.composer/vendor/bin is in my $PATH.

So how can I get this workking?

steelbrain commented 9 years ago

@jonnybarnes it's actually a node's internal error that it throws when the executable was not found or didn't have +x chmod or isn't readable at all.

jonnybarnes commented 9 years ago

But I can type phpcs --standard=PSR2 /path/to/project/file.php and it works?

So why can’t node find it?

steelbrain commented 9 years ago

It's a known bug with OSX, and actually comes from node. If you spawn atom from CLI You'll see that it works, but when you run it from applications, You'll have to enter phpcs path in the config explicitally

jonnybarnes commented 9 years ago

I'm using atom on Linux. I'll try running it from the CLI.

steelbrain commented 9 years ago

How have you extended your $PATH?

jonnybarnes commented 9 years ago

Starting it from the shell indeed allows atom(/node) to use phpcs.

I use ZSH, the last line of my .zshrc file is export PATH="$PATH:/home/jonny/.bin:/home/jonny/.composer/vendor/bin"