question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Eslint cannot find global install

See original GitHub issue

Hi there,

So this is something that seems to have happened quite recently. I have installed eslint and eslint-plugin-react globally using npm i -g

I have an .eslintrc file in my home folder like so:

{
  "env": {
    "browser": true,
    "commonjs": true,
    "es6": true,
    "node": true
  },
  "plugins": [
    "react"
  ],
  "extends": ["eslint:recommended", "plugin:react/recommended"],
  "globals": {
    "$": true
  },
  "parser": "babel-eslint",
  "parserOptions": {
    "sourceType": "module",
    "ecmaFeatures": {
      "jsx": true,
      "modules": true
    }
  },
  "rules": {
    "brace-style": "error",
    "camelcase": ["error", { "properties": "never" }],
    "comma-dangle": ["error", "never"],
    "func-call-spacing": ["error", "never"],
    "eqeqeq": "warn",
    "indent": [ "error", 2, { "SwitchCase": 1 } ],
    "key-spacing": [ "error", { "beforeColon": false } ],
    "no-console": "off",
    "no-fallthrough": "warn",
    "prefer-const": "error",
    "quotes": [ "error", "single" ],
    "semi": [ "error", "never" ],
    "react/prop-types": [ 0 ]
  }
}

I get the following error when I try to lint a file from the command line:

Oops! Something went wrong! :(

ESLint: 6.0.1.

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "/path/to/project/folder".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

    npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in "PersonalConfig".

If you still can't figure out the problem, please stop by https://gitter.im/eslint/eslint to chat with the team.

I appreciate I could probably fix the issue by installing the plugin to devDependencies, but I would like to keep it global.

Any ideas?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:15
  • Comments:39 (17 by maintainers)

github_iconTop GitHub Comments

62reactions
ljharbcommented, Aug 16, 2019

@jekusz if every developer isn’t forced to use the linter, then no developer should be permitted to. Projects that aren’t linted, shouldn’t be. (all projects should, of course, be linted)

50reactions
jektvikcommented, Jul 15, 2019

Why was this closed ? I’ve just run into the very same issue. The use case is this, the company doesn’t want to add linting to the code repo, but I still want it to run whenever I’m working on the code-base to get whatver utility I can out of it. Currently looking for a way to tell eslint to look for plugins (react) in the global install folder.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to install ESlint globally? - Stack Overflow
To install eslint globally: npm install -g eslint. To install eslint in your project folder: npm install eslint --save-dev · Add in package.json ......
Read more >
Using globally installed "standard" package causes "Cannot ...
Using globally installed "standard" package causes "Cannot find module 'eslint-plugin-react'" error · npm install standard@14.3.1 -g · create a new project, ...
Read more >
eslint/eslint - Gitter
This can happen for a couple different reasons: 1. If ESLint is installed globally, then make sure eslint-plugin-jsx-a11y is also installed globally. A...
Read more >
Getting Started with ESLint - Pluggable JavaScript Linter
ESLint is a tool for identifying and reporting on patterns found in ... It is also possible to install ESLint globally rather than...
Read more >
ESLint - npm
An AST-based pattern checker for JavaScript.. Latest version: 8.30.0, last published: 13 days ago. Start using eslint in your project by ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found