Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module 'eslint-plugin-react' (v3.8.0) #137

Closed
pdehaan opened this issue May 12, 2015 · 16 comments

Comments

@pdehaan
Copy link

commented May 12, 2015

I updated from 3.7.3 to 3.8.0 and seem to be getting the following error:

Error: Cannot find module 'eslint-plugin-react'


$ ./node_modules/.bin/standard --version
3.7.3

$ npm test

> restmail-autoauth@1.0.0 test /Users/pdehaan/dev/github/restmail-autoauth
> standard

$ npm i standard@latest -D
npm WARN package.json restmail-autoauth@1.0.0 No repository field.
npm WARN package.json restmail-autoauth@1.0.0 No README data
npm WARN prefer global standard@3.8.0 should be installed with -g
standard@3.8.0 node_modules/standard
...
$ ./node_modules/.bin/standard --version
3.8.0

$ npm test

> restmail-autoauth@1.0.0 test /Users/pdehaan/dev/github/restmail-autoauth
> standard

standard: Unexpected linter output:

Error: Cannot find module 'eslint-plugin-react'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at /Users/pdehaan/dev/github/restmail-autoauth/node_modules/eslint/lib/cli-engine.js:107:26
    at Array.forEach (native)
    at loadPlugins (/Users/pdehaan/dev/github/restmail-autoauth/node_modules/eslint/lib/cli-engine.js:98:21)
    at processFile (/Users/pdehaan/dev/github/restmail-autoauth/node_modules/eslint/lib/cli-engine.js:179:5)
    at /Users/pdehaan/dev/github/restmail-autoauth/node_modules/eslint/lib/cli-engine.js:332:26
    at walk (/Users/pdehaan/dev/github/restmail-autoauth/node_modules/eslint/lib/util/traverse.js:81:9)

If you think this is a bug in `standard`, open an issue: https://github.com/feross/standard
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0
@feross

This comment has been minimized.

Copy link
Member

commented May 12, 2015

Looks like an npm demon ;-)

Try removing the node_modules folder in your app and reinstalling.

@pdehaan

This comment has been minimized.

Copy link
Author

commented May 12, 2015

That seemed to do it. Sorry for the noise.

@pdehaan pdehaan closed this May 12, 2015

@mderazon

This comment has been minimized.

Copy link

commented Sep 7, 2015

also getting this for some reason (also after cleaning node_modules)

standard: Unexpected linter output:

Error: Cannot find module 'eslint-config-standard-react'
Referenced from: /myapp/node_modules/standard/rc/.eslintrc
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:286:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at readConfigFromFile (/myapp/node_modules/eslint/lib/config.js:113:44)
    at loadConfig (/myapp/node_modules/eslint/lib/config.js:134:22)
    at /myapp/node_modules/eslint/lib/config.js:165:46
    at Array.reduceRight (native)
    at loadConfig (/myapp/node_modules/eslint/lib/config.js:149:36)
    at new Config (/myapp/node_modules/eslint/lib/config.js:374:38)
$ npm --version
2.13.3
$ node --version
v3.2.0

Maybe conflicting packages ?

Here's my package.json

"dependencies": {
    "async": "^1.3.0",
    "body-parser": "^1.12.3",
    "compression": "^1.4.2",
    "cookie-parser": "^1.3.4",
    "express": "^4.9.6",
    "lodash": "^3.7.0",
    "moment-timezone": "^0.4.0",
    "morgan": "^1.3.2",
    "node-deeplink": "^0.2.1",
    "node-uuid": "^1.4.3",
    "request": "^2.55.0",
    "stripe": "^3.3.4",
    "traverse": "^0.6.6",
    "verror": "^1.5.1"
  },
  "devDependencies": {
    "babel-eslint": "^4.1.1",
    "chai": "^3.0.0",
    "co-mocha": "^1.1.0",
    "co-supertest": "0.0.10",
    "eslint": "^1.3.1",
    "mocha": "^2.2.4",
    "promised-mongo": "^1.2.0",
    "standard": "^5.2.1",
    "supertest": "^1.0.1"
  }
}
@mderazon

This comment has been minimized.

Copy link

commented Sep 7, 2015

Removing babel-eslint and eslint seems to have solved it.

Still figuring out a way for everything (including react-standard) to work in harmony in both cli and sublime-text

@feross

This comment has been minimized.

Copy link
Member

commented Sep 8, 2015

When you get errors like this, I highly recommend running:

rm -rf node_modules/
npm install

npm 2.x isn't very good about keeping the node_modules folder in a working state if you npm rm some-module when some-module is used by one of your dependencies.

@edsadr

This comment has been minimized.

Copy link

commented Sep 9, 2015

Having the same problem ... rm -rf node_modules not helping at all but in Node V4.0.0 and io.js 3.3.0 ... Node 0.10.40 seems to be fine... so opening this issue: #256

@anthonybrown

This comment has been minimized.

Copy link

commented Aug 20, 2016

Having same issue as @edsadr

@feross

This comment has been minimized.

Copy link
Member

commented Aug 20, 2016

@anthonybrown Without any additional information, there's nothing I can do to help you. Try the advice already contained in this issue.

@anthonybrown

This comment has been minimized.

Copy link

commented Aug 20, 2016

@feross removing the node_modules and running npm install does nothing except reproduce the error below.
I will provide my package.jsonfile for you as well.

`standard: Unexpected linter output:

Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react'
Referenced from: /usr/local/lib/node_modules/standard/eslintrc.json
at Function.Module._resolveFilename (module.js:440:15)
at Function.Module._load (module.js:388:25)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at Object.load (/usr/local/lib/node_modules/eslint/lib/config/plugins.js:113:26)
at Array.forEach (native)
at Object.loadAll (/usr/local/lib/node_modules/eslint/lib/config/plugins.js:135:21)
at load (/usr/local/lib/node_modules/eslint/lib/config/config-file.js:504:21)
at /usr/local/lib/node_modules/eslint/lib/config/config-file.js:391:36
at Array.reduceRight (native)

If you think this is a bug in standard, open an issue: https://github.com/feross/standard/issues`

@anthonybrown

This comment has been minimized.

Copy link

commented Aug 20, 2016

Here is the gist to my package.json file.

node -v6.3.1
npm -v3.10.6

@pdehaan

This comment has been minimized.

Copy link
Author

commented Aug 21, 2016

@anthonybrown I'm a bit confused... Are you using a globally installed $ standard directly, or running it locally via $ npm test? The error message above seems to be pointing to a global looking (but maybe not) /usr/local/lib/node_modules/ directory.

I'd expect $ npm test to work (assuming all your other local dependencies are installed), but I'd probably expect running $ standard directly to fail, unless you had all the other ESLint plugins also installed globally.

@anthonybrown

This comment has been minimized.

Copy link

commented Aug 21, 2016

@pdehaan yes, you are absolutely correct. Running standard in terminal causes an error but npm run test does not. I made the mistake of installing standard globally (out of ease of use) figuring it would replace eslint, so that's the problem. So, should I remove the globally installed standard install to resolve the error?

@feross

This comment has been minimized.

Copy link
Member

commented Aug 21, 2016

👍 👍 👍

Glad you got it figured out. Thanks @pdehaan

@anthonybrown

This comment has been minimized.

Copy link

commented Aug 21, 2016

reinstalled standard globally and now running standard or npm test does not produce any errors 👍
A little odd but I'm not complaining

@feross

This comment has been minimized.

Copy link
Member

commented Aug 21, 2016

Oh, there were some bugs in eslint earlier around resolving plugins that have since been fixed. That could have been the issue.

@anthonybrown

This comment has been minimized.

Copy link

commented Aug 21, 2016

@feross yep. I'm really liking standard it's suits the way I code in JavaScript anyways so it's a win win for me.

Cheers

@lock lock bot locked as resolved and limited conversation to collaborators May 10, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
5 participants
You can’t perform that action at this time.