eslint-config-standard: Error: Cannot find module 'eslint-config-standard'

eslint -v

v4.2.0

eslint --init

? How would you like to configure ESLint?
  Answer questions about your style
❯ Use a popular style guide
  Inspect your JavaScript file(s)
? Which style guide do you want to follow?
  Google
  Airbnb
❯ Standard
? What format do you want your config file to be in? (Use arrow keys)
❯ JavaScript
  YAML
  JSON

.eslintrc

{
  "extends": "standard"
}

run eslint error

$ eslint app.js
Cannot find module 'eslint-config-standard'
Referenced from: /xxx/.eslintrc
Error: Cannot find module 'eslint-config-standard'

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 16
  • Comments: 15 (2 by maintainers)

Commits related to this issue

Most upvoted comments

@FNGR2911 I know the reason now, because the es-lint I implemented is global installed, so it looks for the global eslint-config-standard. Locally installed can be executed using node_modules/.bin/eslint, or the command is written in the script option of the package.json file!

To fix this, ensure that eslint-config-standard and all the other dependencies listed in the readme, are all installed locally, or all installed globally.

It’s preferred to install all of them locally rather than globally. Check that they’re all listed in package.json.

@vigneshr23, I’m running eslint 4.18.2 on node 9.2.1 and npm 5.5.1 . I was able to run eslint globally by doing this:

npm install eslint-config-standard -g

Then try again, you’ll most likely get more errors but they come with instructions to install more packages.

Happy linting!

Hey I dont understand what is going on here. I tried running eslint --init but the problem still persists. Can anyone help?

@daniel2009 When you want to auto fix your errors, you might want to type:

eslint --fix --ext .js,.vue --ignore-path .gitignore .

inside your project root directory.

But instead you should type:

node_modules/.bin/eslint --fix --ext .js,.vue --ignore-path .gitignore .

or on Windows:

node_modules\.bin\eslint --fix --ext .js,.vue --ignore-path .gitignore .

@u3u It worked!Thanks for help!