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

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 · Fixed by standard/standard#427
Closed

Comments

@knownasilya
Copy link

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
Copy link
Member

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
Copy link
Author

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

@knownasilya
Copy link
Author

It does work in Node 5.6

@knownasilya knownasilya changed the title react missing Cannot find module 'eslint-plugin-react' Feb 16, 2016
@knownasilya knownasilya changed the title Cannot find module 'eslint-plugin-react' Cannot find module 'eslint-plugin-react' with Node 4.2.6 (5.6 works) Feb 16, 2016
@feross
Copy link
Member

feross commented Feb 16, 2016

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

@feross
Copy link
Member

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
Copy link
Author

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
Copy link
Author

@feross any ideas?

@knownasilya
Copy link
Author

@feross
Copy link
Member

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: standard/standard-engine#73 standard/standard#427

@feross feross closed this as completed Feb 18, 2016
@feross
Copy link
Member

feross commented Feb 19, 2016

Released as standard 6.0.6.

@knownasilya
Copy link
Author

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

@feross
Copy link
Member

feross commented Feb 19, 2016

great, thanks for letting me know!

@feross
Copy link
Member

feross commented Feb 19, 2016

Sorry, I had to revert this change in standard v6.0.7 because it caused a much worse issue: standard/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
Copy link
Member

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 pushed a commit to Strider-CD/core that referenced this issue Feb 19, 2016
@knownasilya
Copy link
Author

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
Copy link
Member

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 as completed Dec 27, 2016
kaiwang0119 added a commit to kaiwang0119/standard that referenced this issue Aug 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants