AtomLinter / linter-phpmd

Atom linter plugin for php, using phpmd.
21 stars 4 forks source link

Error: spawn EACCES When I type something in php file #104

Open XXiao12 opened 7 years ago

XXiao12 commented 7 years ago
screen shot 2017-02-15 at 6 06 05 pm

Hello! I have just recently downloaded Atom and got packages for php, html, css, and haskell. I have been working on my php file a few day ago with no error, however today this error came up. I'm not sure if I'm missing packages or if my executable PATH is not right. What does this error mean?

Error: spawn EACCES
    at exports._errnoException (util.js:1026:11)
    at ChildProcess.spawn (internal/child_process.js:313:11)
    at exports.spawn (child_process.js:392:9)
    at /Users/Shirleyx/.atom/packages/linter-php/node_modules/sb-exec/lib/index.js:24:53
    at /Users/Shirleyx/.atom/packages/linter-php/node_modules/sb-exec/lib/index.js:23:18
    at next (<anonymous>)
    at step (/Users/Shirleyx/.atom/packages/linter-php/node_modules/sb-exec/lib/index.js:113:191)
    at /Users/Shirleyx/.atom/packages/linter-php/node_modules/sb-exec/lib/index.js:113:368

Community packages downloaded for php: linter-php linter-phpcs linter-phpmd php-cs-fixer php-debug

Sorry if I am posting this in the wrong section

Arcanemagus commented 7 years ago

Hmmm, usually that error pops up when a directory is put into the executable path, instead of the full path to the executable. Generally you should be able to leave it at the default (phpmd) and let your system resolve it, but if that isn't working for some reason you need to specify the full path.

You can find this on your system by running which phpmd.

XXiao12 commented 7 years ago

I am using a mac so would I type it in my terminal? I got:

usage: which [-as] program ...

as the output

XXiao12 commented 7 years ago

I also tried npm install atom-linter@~4.6.1 from another thread: └─┬ atom-linter@4.6.1 invalid └── sb-promisify@1.3.0

XXiao12 commented 7 years ago
Error: spawn EACCES
    at exports._errnoException (util.js:1026:11)
    at ChildProcess.spawn (internal/child_process.js:313:11)
    at exports.spawn (child_process.js:392:9)
    at /Users/Shirleyx/.atom/packages/linter-phpmd/node_modules/sb-exec/lib/index.js:24:53
    at /Users/Shirleyx/.atom/packages/linter-phpmd/node_modules/sb-exec/lib/index.js:23:18
    at next (<anonymous>)
    at step (/Users/Shirleyx/.atom/packages/linter-phpmd/node_modules/sb-exec/lib/index.js:113:191)
    at /Users/Shirleyx/.atom/packages/linter-phpmd/node_modules/sb-exec/lib/index.js:113:368
Arcanemagus commented 7 years ago

That version of atom-linter is quite old now, run npm update to bring it back to what it should be!

This should work just fine if you go into Settings -> Packages -> linter-phpmd and make sure the setting is on it's default value: image

(The same goes for linter-phpcs)

XXiao12 commented 7 years ago

It says:

Error: Failed to spawn command phpmd. Make sure phpmd is installed and on your PATH

Arcanemagus commented 7 years ago

Okay, that's progress at least.

What do you get when you run which phpmd?

XXiao12 commented 7 years ago

It returns nothing

XXiao12 commented 7 years ago
Error: Failed to spawn command `phpmd`. Make sure `phpmd` is installed and on your PATH
    at /Users/Shirleyx/.atom/packages/linter-phpmd/node_modules/atom-linter/lib/helpers.js:102:24
    at process._tickCallback (internal/process/next_tick.js:103:7)
Arcanemagus commented 7 years ago

Hmm, I thought I read in your first post that you already had phpmd installed, but on re-reading it I don't see that, which would explain all your other issues.

Have you installed phpmd yet?

XXiao12 commented 7 years ago

yes I installed it, I forgot to include phpmd in the first sentence. Linter-phpmd is phpmd right?

Arcanemagus commented 7 years ago

Not quite, linter-phpmd is a wrapper around phpmd, allowing it to be automatically ran and the output transformed into an output that works with the Linter package.

You need to have phpmd installed on your system, and most likely available on your $PATH.

XXiao12 commented 7 years ago

ohh I see I only installed php and the composer. How would I download phpmd? I tried the command but it did not work. Could I have installed composer wrong?

Arcanemagus commented 7 years ago

The page I linked to lists several different ways of installing phpmd, I would recommend using Composer (installation).

I'm not sure what command you tried that didn't work, but making sure you have Composer working will probably be your first step.

XXiao12 commented 7 years ago

Yup I followed that website to install composer and I got composer to work but the error on atom still pops up :(

loureirorg commented 6 years ago

Make sure to have CodeSniffer installed. Instructions for Ubuntu:

sudo apt install phpmd
sudo apt install php-pear
sudo pear install PHP_CodeSniffer

Then, restart Atom.