Cannot find module 'eslint-plugin-react' with Node 4.2.6 (5.6 works) #8

Closed
knownasilya opened this Issue Feb 15, 2016 · 16 comments

Projects

None yet

2 participants

@knownasilya
Error: Failed to load plugin react: Cannot find module 'eslint-plugin-react'
  at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.module.exports.load (/Users/iradchenko/sandbox/core/node_modules/eslint/lib/config/plugins.js:116:26)
    at Array.forEach (native)
    at Object.module.exports.loadAll (/Users/iradchenko/sandbox/core/node_modules/eslint/lib/config/plugins.js:134:21)
    at processText (/Users/iradchenko/sandbox/core/node_modules/eslint/lib/cli-engine.js:158:17)
    at processFile (/Users/iradchenko/sandbox/core/node_modules/eslint/lib/cli-engine.js:227:18)
    at executeOnFile (/Users/iradchenko/sandbox/core/node_modules/eslint/lib/cli-engine.js:602:23)

Not sure why I'd need to install this, since I'm not using react. Seems like a dep is missing somewhere..

@feross
Owner
feross commented Feb 15, 2016

Can you try deleting your node_modules folder and re-installing everything?

Also, what version of node are you using?

@knownasilya

Tried that, same result. I'm using node 4.2.6 and npm 2.14.12.

@knownasilya

It does work in Node 5.6

@knownasilya knownasilya changed the title from react missing to Cannot find module 'eslint-plugin-react' Feb 16, 2016
@knownasilya knownasilya changed the title from Cannot find module 'eslint-plugin-react' to Cannot find module 'eslint-plugin-react' with Node 4.2.6 (5.6 works) Feb 16, 2016
@feross
Owner
feross commented Feb 16, 2016

Can you run ./node_modules/.bin/snazzy --version and paste the result?

@feross
Owner
feross commented Feb 16, 2016

Also, can you share if you're also depending on eslint or standard separately, in addition to snazzy in your package.json?

@knownasilya

6.0.5 for the command. Yes I also have

    "eslint": "^2.0.0",
    "eslint-config-standard": "^5.1.0",
    "eslint-plugin-promise": "^1.0.8",
    "eslint-plugin-standard": "^1.3.0",
    "babel-eslint": "^4.0.10"
@knownasilya

@feross any ideas?

@feross feross referenced this issue in feross/eslint-config-standard Feb 18, 2016
Closed

Configuration for rule "no-labels" is invalid #23

@feross feross added a commit to feross/standard that referenced this issue Feb 18, 2016
@feross Use install location of standard as eslint `cwd` 1dac937
@feross
Owner
feross commented Feb 18, 2016

Since you're depending directly on eslint, npm2 is not bothering to install eslint into standard's node_modules folder. So when standard does require('eslint') it's getting the top-level copy of eslint. That's usually not a problem, and happens all the time with npm.

But, it causes problems when eslint goes to require('eslint-plugin-react)inside of snazzy. Becauseeslintis hoisted out to the top level, it's not going to findeslint-plugin-reactwhere it lives inside ofsnazzy/node_modules/standard/node_modules/eslint-plugin-react`.

Quick fix for you is to also install eslint-plugin-react at the top-level.

PRs for the real fix are here: Flet/standard-engine#73 feross/standard#427

@feross feross closed this Feb 18, 2016
@feross
Owner
feross commented Feb 19, 2016

Released as standard 6.0.6.

@knownasilya

Fix confirmed, just reran the build (reinstall snazzy).

@feross
Owner
feross commented Feb 19, 2016

great, thanks for letting me know!

@feross
Owner
feross commented Feb 19, 2016

Sorry, I had to revert this change in standard v6.0.7 because it caused a much worse issue: feross/standard#429

We'll have to hold out for a proper fix from eslint: eslint/eslint#5175

@feross feross reopened this Feb 19, 2016
@feross
Owner
feross commented Feb 19, 2016

I suggest just installing eslint-plugin-react at the top level of your project, or removing the dependency on eslint at the top-level to make things work for now.

@knownasilya knownasilya added a commit to Strider-CD/core that referenced this issue Feb 19, 2016
@knownasilya knownasilya Remove eslint dep 8614c28
@knownasilya

Was trying to use codeclimate eslint engine, so I might move away from snazzy and use https://github.com/jden/standard-codeclimate, but it's outdated.. was hoping to use latest eslint.

@feross
Owner
feross commented Feb 23, 2016

@knownasilya You should talk with @jden. He's probably fine with updating the standard version in standard-codeclimate.

@feross feross closed this Dec 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment