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 fails to find plugin in node_modules folder

See original GitHub issue

Tell us about your environment

  • ESLint Version: 3.11.0
  • Node Version: 4.6.0
  • npm Version: 2.15.11

What parser (default, Babel-ESLint, etc.) are you using? Default parser through the command line - also experienced it through the atom plugin linter-eslint

Please show your full configuration:

module.exports = {
    root: true,
    parserOptions: {
        ecmaVersion: 6,
        sourceType: 'module'
    },
    extends: [
        'eslint:recommended',
        'plugin:ember-suave/recommended'
    ],
    env: {
        browser: true
    },
    rules: {
        indent: ['error', 4],
        'space-before-function-paren': ['error', {anonymous: 'ignore', named: 'never'}],
        'object-curly-spacing': ['error', 'never'],
        'array-bracket-spacing': ['error', 'never'],
        'key-spacing': ['error', {mode: 'minimum'}],
        'keyword-spacing': ['error', {overrides: {
            'catch': {'after': true}
        }}],
        'ember-suave/require-access-in-comments': 'off'
    },
    globals: {
        moment: false,
        validator: false
    }
};

What did you do? Please include the actual source code causing the issue.

Source code: master branch of https://github.com/TryGhost/Ghost-Admin

Steps to reproduce:

  • clone the repo
  • npm install (verify that the eslint-plugin-ember-suave is installed into node_modules)
  • eslint app

What did you expect to happen? I expected ESLint to run.

What actually happened? Please include the actual, raw output from ESLint. Raw error output:

Cannot find module 'eslint-plugin-ember-suave'
Referenced from: /Users/acburdine/Sites/Ghost/eslint-bug-test/Ghost-Admin/.eslintrc.js
Error: Cannot find module 'eslint-plugin-ember-suave'
Referenced from: /Users/acburdine/Sites/Ghost/eslint-bug-test/Ghost-Admin/.eslintrc.js
    at Object.resolve (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/util/module-resolver.js:74:19)
    at resolve (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:473:33)
    at load (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:495:26)
    at /Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:391:36
    at Array.reduceRight (native)
    at applyExtends (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:362:28)
    at Object.load (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config/config-file.js:529:22)
    at loadConfig (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config.js:63:33)
    at getLocalConfig (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config.js:130:29)
    at Config.options.env.globals.Config.getConfig (/Users/acburdine/.nvm/versions/node/v4.6.0/lib/node_modules/eslint/lib/config.js:256:22)

Additional Information: I also experienced the same issue with https://github.com/jgwhite/ember-sortable (after adding the same config). Initially I thought this was because both depended indirectly on eslint through ember-cli-eslint, and that does fix the issue with atom-linter, but I think the issue is related to node’s resolution process.

Potential related issue: #7083

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
not-an-aardvarkcommented, Dec 6, 2016

I would be in favor of using the JSCS/grunt/gulp approach of having the global installation defer to the local installation if it exists. We can always have a --use-global-eslint option or something if people want to override the behavior.

1reaction
markelogcommented, Nov 30, 2016

Not only JSCS, but others tools as well, from top of my head – grunt/gulp maybe even jshint.

Worked as charm and you know, doing./node_modules/.bin/eslint is kinda ugly

Read more comments on GitHub >

github_iconTop Results From Across the Web

Shared eslint config cannot find node modules - Stack Overflow
As I'm using RushJS to manage my monorepo, I'm using a patch to ESLint to allow a shared-config npm package to load plugins...
Read more >
eslint-plugin-import - npm
This plugin intends to support linting of ES2015+ (ES6+) import/export syntax, and prevent issues with misspelling of file paths and import ...
Read more >
eslint/eslint - Gitter
Failed to load plugin 'react' declared in 'project-igi/.eslintrc.js': Cannot find module 'eslint-plugin-react' This can happen for a couple of ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
To fix the error, you need to install the package that is absent in your project directory – npm install package-name or yarn...
Read more >
ESLint error when scanning custom modules - Drupal
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: npm install eslint-plugin-prettier@latest -- ...
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