Skip to content
This repository has been archived by the owner on Jul 8, 2020. It is now read-only.

Cannot read config file: .eslintrc #382

Closed
stumpy1982 opened this issue Jun 20, 2016 · 4 comments
Closed

Cannot read config file: .eslintrc #382

stumpy1982 opened this issue Jun 20, 2016 · 4 comments

Comments

@stumpy1982
Copy link

stumpy1982 commented Jun 20, 2016

I generate a new project with the V1.8 on several machines with node version 6.2.2 and after installation i got this error:

Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config/config-file.js:402
            throw e;
            ^
Error: Cannot read config file: /Users/<username>/<projectfolder>/app/.eslintrc
Error: ENOENT: no such file or directory, open '/Users/<username>/<projectfolder>/app/.eslintrc'
Referenced from: /Users/<username>/<projectfolder>/<projectname>/test/karma/.eslintrc
    at Error (native)
    at Object.fs.openSync (fs.js:634:18)
    at Object.fs.readFileSync (fs.js:502:33)
    at readFile (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config/config-file.js:71:15)
    at loadLegacyConfigFile (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config/config-file.js:143:44)
    at loadConfigFile (/Users//<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config/config-file.js:223:22)
    at load (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config/config-file.js:500:18)
    at /Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config/config-file.js:392:36
    at Array.reduceRight (native)
    at applyExtends (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config/config-file.js:363:28)
    at Object.load (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config/config-file.js:531:22)
    at loadConfig (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config.js:64:33)
    at getLocalConfig (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config.js:126:23)
    at Config.getConfig (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/config.js:227:22)
    at processText (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/cli-engine.js:223:27)
    at CLIEngine.executeOnText (/Users/<username>/<projectfolder>/<projectname>/node_modules/eslint/lib/cli-engine.js:761:26)

The solution for this problem was to update the path of my protractor and karma .eslintrc to this: "../app/.eslintrc"

@nadouani
Copy link

+1

@stumpy1982 stumpy1982 changed the title Gulp watch error Cannot read config file: .eslintrc Jun 20, 2016
@lordgreg
Copy link
Contributor

👍

@gruppjo
Copy link
Contributor

gruppjo commented Jun 20, 2016

The latest eslint release (3 days ago) changed how extend works.

I'll give this a closer look this week.

So for a quick fix simply correct the following line in test/karma/.eslintrc and test/protractor/.eslintrc:

"extends": "../app/.eslintrc",

Although I'm a little surprised because the paths are correct in their original state, which is ../../app/.eslintrc and not ../app/.eslintrc. However the error displayed in gulp suggests that eslint adds an additional ../ and thus traverses out of the project dir.

@gruppjo
Copy link
Contributor

gruppjo commented Jun 23, 2016

I can no longer reproduce this as of today. @lordgreg, @nadouani, @stumpy1982. Can you confirm?

  1. Restore the paths in the .eslintrc files
  2. To make sure you're running the latest versions of eslint or gulp-eslint delete the node modules folder rm -f node_modules and run npm install again.

@gruppjo gruppjo closed this as completed Jun 27, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants