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

Error running PHPCS TypeError: Invalid Version: undefined

Open andy-preston opened this issue 4 years ago • 7 comments

I'm getting the following message in my Atom console ever time I try to run linter-phpcs

I assume it's got something to do with Atom's continuous changing of the linter API???

/home/andyp/.atom/packages/linter/dist/index.js:1 [Linter] Error running PHPCS TypeError: Invalid Version: undefined at new SemVer (/home/andyp/.atom/packages/linter-eslint/node_modules/semver/semver.js:314) at compare (/home/andyp/.atom/packages/linter-eslint/node_modules/semver/semver.js:647) at Function.gte (/home/andyp/.atom/packages/linter-eslint/node_modules/semver/semver.js:703) at Object. (/home/andyp/.atom/packages/linter-phpcs/lib/main.js:224) at Generator.next () at step (/home/andyp/.atom/packages/linter-phpcs/lib/main.js:5) (anonymous) @ /home/andyp/.atom/packages/linter/dist/index.js:1 /home/andyp/.atom/packages/php-cs-fixer/lib/php-cs-fixer.coffee:240 php exited with code: 0

andy-preston avatar Oct 17 '20 12:10 andy-preston

Can confirm that I am seeing the same behaviour.

Screenshot 2020-10-20 at 16 54 02

markb-wa avatar Oct 20 '20 15:10 markb-wa

Can you share your linter-phpcs settings and the output of phpcs --version in a terminal?

UziTech avatar Mar 31 '21 00:03 UziTech

Certainly.

Output of phpcs --version: Screenshot 2021-03-31 at 09 05 40

linter-phpcs setings: Screenshot 2021-03-31 at 09 08 57 Screenshot 2021-03-31 at 09 08 31 Screenshot 2021-03-31 at 09 08 43

And for reference: Screenshot 2021-03-31 at 09 16 52

markb-wa avatar Mar 31 '21 08:03 markb-wa

Can you update to the latest version and provide the error if it is still happening?

UziTech avatar Mar 31 '21 15:03 UziTech

Screenshots are a really unhelpful way of sharing information.

andy-preston avatar Mar 31 '21 15:03 andy-preston

It looks like the error comes from not being able to parse the phpcs version from the executable listed in the Executable Path setting.

I just released a new version (v1.8.1) that might provide a better error with more information that might be helpful.

If this happens again please share the error thrown. It should be something like: Cannot parse PHPCS version for {Executable Path}: '{version output}'

UziTech avatar Mar 31 '21 16:03 UziTech

Can you update to the latest version and provide the error if it is still happening?

Have updated to the latest, and so far so good. Will update if I see the error recur.

markb-wa avatar Mar 31 '21 17:03 markb-wa