AtomLinter / linter-phpmd

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

error on save #43

Closed tomsteg closed 8 years ago

tomsteg commented 8 years ago

when I save a php file with html code in it, I get an error:

Error: Cannot find module 'xregexp'
Error: Cannot find module 'xregexp'
    at Module._resolveFilename (module.js:336:15)
    at Function.Module._resolveFilename (/Applications/Atom.app/Contents/Resources/app.asar/src/module-cache.js:383:52)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (/Applications/Atom.app/Contents/Resources/app.asar/src/native-compile-cache.js:50:27)
    at Object.parse (/Users/thomassteglich/.atom/packages/linter-php/node_modules/atom-linter/lib/helpers.js:302:15)
    at /Users/thomassteglich/.atom/packages/linter-phpmd/lib/main.coffee:61:26
    at process._tickCallback (node.js:368:9)
Arcanemagus commented 8 years ago

As reported by another user it sounds like apm is failing to install the dependencies properly, can you try uninstalling the plugin and then installing it again?

tomsteg commented 8 years ago

I uninstalled it and installed it again, but I get the same error. I added a screenshot of my settings. 2016-01-29_09-43-34

Arcanemagus commented 8 years ago

Do you have npm installed on your system? If so can you run npm list --depth=0 in the ~/.atom/packages/linter-phpmd folder?

The only reason it should ever be saying that is if it somehow has an out of date atom-linter installed, but got as far in updating it as removing that old dependency.

tomsteg commented 8 years ago

I get the following result:

linter-phpmd@1.4.1 /Users/thomassteglich/.atom/packages/linter-phpmd
├── atom-linter@4.3.4
└── atom-package-deps@3.0.7
Arcanemagus commented 8 years ago

Hmmm, looks like it's actually loading the module from the linter-php package, can you run npm list (without the depth restriction) in there?

tomsteg commented 8 years ago

Here is the list without restrictions (and error line at the bottom):

linter-phpmd@1.4.1 /Users/thomassteglich/.atom/packages/linter-phpmd
├─┬ atom-linter@4.3.4
│ ├─┬ consistent-path@1.0.3
│ │ └─┬ shell-path@1.0.8
│ │   └─┬ strip-ansi@3.0.0
│ │     └── ansi-regex@2.0.0
│ ├── named-js-regexp@1.3.1
│ └─┬ tmp@0.0.28 invalid
│   └── os-tmpdir@1.0.1
└─┬ atom-package-deps@3.0.7
  └── sb-callsite@1.1.2

npm ERR! invalid: tmp@0.0.28 /Users/thomassteglich/.atom/packages/linter-phpmd/node_modules/atom-linter/node_modules/tmp
Arcanemagus commented 8 years ago

Run that in ~/.atom/packages/linter-php (not linter-phpmd) :wink:

tomsteg commented 8 years ago

Oh, sorry. Here is the list from linter-php:

linter-php@1.1.7 /Users/thomassteglich/.atom/packages/linter-php
├─┬ atom-linter@4.3.4
│ ├─┬ consistent-path@1.0.3
│ │ └─┬ shell-path@1.0.8
│ │   └─┬ strip-ansi@3.0.0
│ │     └── ansi-regex@2.0.0
│ ├── named-js-regexp@1.3.1
│ └─┬ tmp@0.0.28 invalid
│   └── os-tmpdir@1.0.1
└─┬ atom-package-deps@3.0.7
  └── sb-callsite@1.1.2

npm ERR! invalid: tmp@0.0.28 /Users/thomassteglich/.atom/packages/linter-php/node_modules/atom-linter/node_modules/tmp
tomsteg commented 8 years ago

And here is the list from phpcs:

linter-phpcs@1.3.0 /Users/thomassteglich/.atom/packages/linter-phpcs
├─┬ atom-linter@3.4.1
│ ├─┬ tmp@0.0.28 invalid
│ │ └── os-tmpdir@1.0.1
│ └── xregexp@2.0.0
├── atom-package-deps@2.1.3
└─┬ minimatch@3.0.0
  └─┬ brace-expansion@1.1.2
    ├── balanced-match@0.3.0
    └── concat-map@0.0.1

npm ERR! invalid: tmp@0.0.28 /Users/thomassteglich/.atom/packages/linter-phpcs/node_modules/atom-linter/node_modules/tmp

I disabled phpcs, restarted atom, and enabled phpcs again. The error has gone.

Arcanemagus commented 8 years ago

Looks like a release for linter-phpcs is in order :wink:.

I wish Atom would fix the bug that causes issues like this :frowning:.