coryhouse / react-flux-starter-kit

Quickly get started with React and Flux using Browserify and Gulp
682 stars 247 forks source link

Error: Cannot find module 'eslint-config-defaults/configurations/eslint' #9

Closed falconmick closed 7 years ago

falconmick commented 7 years ago

I made a clean download of the repo, ran the following:

npm install gulp

and I got this:

C:\dev\tmp\react-flux-starter-kit\node_modules\gulp-eslint\node_modules\eslint\lib\config.js:129
                    throw e;
                    ^

Error: Cannot find module 'eslint-config-defaults/configurations/eslint'
Referenced from: C:\Users\xxx\.eslintrc
    at Function.Module._resolveFilename (module.js:325:15)
    at Function.Module._load (module.js:276:25)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at loadConfig (C:\dev\tmp\react-flux-starter-kit\node_modules\gulp-eslint\node_modules\eslint\lib\config.js:96:48)
    at C:\dev\tmp\react-flux-starter-kit\node_modules\gulp-eslint\node_modules\eslint\lib\config.js:123:46
    at Array.reduceRight (native)
    at loadConfig (C:\dev\tmp\react-flux-starter-kit\node_modules\gulp-eslint\node_modules\eslint\lib\config.js:111:36)
    at getPersonalConfig (C:\dev\tmp\react-flux-starter-kit\node_modules\gulp-eslint\node_modules\eslint\lib\config.js:194:18)
    at getLocalConfig (C:\dev\tmp\react-flux-starter-kit\node_modules\gulp-eslint\node_modules\eslint\lib\config.js:238:55)

looks like as I have eslint already installed that it is trying to use my newer version of eslint and it's funky config.

Is there a way to tell it to use the local over global?

coryhouse commented 7 years ago

Thanks for the ticket! Can you share details about your environment? Node version npm version OS Where are you running this? On the OS command line or via an editor?

benjaminrlawrence commented 7 years ago

I'm having the same issue. I'm on Windows 10, running in the CMD.exe command line. Node v4.6.0 and npm v2.15.9

benjaminrlawrence commented 7 years ago

Fixed error when I installed npm modules eslint-config-defaults and then eslint-plugin-react (latest versions, which were 9.0.0 and 6.5.0, respectively). Now everything runs, but I get a linting error of "cannot find module 'babel-eslint'". I'll install that and report back.

benjaminrlawrence commented 7 years ago

installing babel-eslint broke everything, I'll just run this with the error getting thrown within eslint.

azizalibasic commented 7 years ago

@benjaminrlawrence I am getting the same error, did you get this solved? Making it difficult to do the plural sight course.

@coryhouse : Node version: 7.1.0 npm version: 3.10.9 OS: WIndows 10 Where are you running this? : Git Bash On the OS command line or via an editor? : Command Line

benjaminrlawrence commented 7 years ago

@Kizer2 I was unable to solve this issue. What I did to continue the course was just do away with the linting task. All of the other tasks seem to be working, and you just don't get any linting, which is really okay. It's just a nice-to-have.

coryhouse commented 7 years ago

Can one of you share your project on Github so I can try to reproduce?

Havret commented 7 years ago

Here you are! It would would be great if you fix it.

https://github.com/Havret/react-flux-starter-kit-master

coryhouse commented 7 years ago

@Havret That repo is empty.

Havret commented 7 years ago

@coryhouse It should be there now. Should I include node_modules dir as well?

PS. Simple workaround is to comment out this troublesome gulp linting task.

coryhouse commented 7 years ago

I have tried on both Mac and Windows and am unable to reproduce using @Havret repo or this course starter kit. One suggestion: delete the node_modules directory and re-run npm install.

If that doesn't help, you can try deleting the node_module directory again and also deleting npm-shrinkwrap.json, then running npm install again.

coryhouse commented 7 years ago

Please try adding this line to your .eslintrc and let me know if this resolves: https://github.com/coryhouse/react-slingshot/blob/master/.eslintrc#L2

coryhouse commented 7 years ago

One final thing that is likely the root cause for you all:

Remove the .eslintrc file from your user's directory. I suspect you have a .eslintrc file in your user's directory that is conflicting with the course .eslintrc.

Havret commented 7 years ago

Yes, it helped. Cheers!

coryhouse commented 7 years ago

Excellent! Which change resolved the issue for you @Havret ?

Havret commented 7 years ago

@coryhouse The second one.

For the record, .eslintrc is coming back to to my user's directory once in a while (I presume after every single npm install?), breaking the whole thing again and again, so remember to keep deleting it, if linting crashes.

benjaminrlawrence commented 7 years ago

I just did the same fix as @Havret. It works for me too.

coryhouse commented 7 years ago

Great to hear! Closing since we've found the fix.

maninderp commented 7 years ago

@coryhouse I also faced the same issue. Probably you should edit the PluralSight course to add a tip to delete the .eslintrc file from the users directory.