Failed to load plugin '@typescript-eslint'...

See original GitHub issue

( Been banging my head on this issue for a couple hours, tried different versions of node and npm, tried different config settings, any others getting this? Am I troubleshooting this all wrong?!)

expectations

When I run ESLint from the command line it works just fine: eslint --ext .jsx,.js,.tsx,.ts --max-warnings 0 ./src

what I get

When I install the dbaeumer.vscode-eslint extension it doesn’t start & this is printed in the Output tab (Dropdown: ESLint)

[Info  - 1:20:32 PM] ESLint server stopped.
[Info  - 1:20:33 PM] ESLint server running in node v8.9.0
[Info  - 1:20:34 PM] ESLint server is running.
[Info  - 1:20:35 PM] ESLint library loaded from: /home/j/Repos/sam/sam-frontend/node_modules/eslint/lib/api.js
(node:2115) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Failed to load plugin '@typescript-eslint' declared in 'sam-frontend/.eslintrc.js': Cannot find module '@typescript-eslint/eslint-plugin'
Require stack:
- /home/j/Repos/sam/__placeholder__.js
Referenced from: /home/j/Repos/sam/sam-frontend/.eslintrc.js
(node:2115) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:2115) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): Error: Failed to load plugin '@typescript-eslint' declared in 'sam-frontend/.eslintrc.js': Cannot find module '@typescript-eslint/eslint-plugin'
Require stack:
- /home/j/Repos/sam/__placeholder__.js
Referenced from: /home/j/Repos/sam/sam-frontend/.eslintrc.js

from .eslintrc.js

module.exports = {
  "parser": "@typescript-eslint/parser",
  "extends": [
    "airbnb",
    "plugin:@typescript-eslint/recommended"
  ],
  "parserOptions": {
    "ecmaVersion": 2018,
    "sourceType": "module"
  },
  "env": {
    "browser": true,
    "jest/globals": true
  },
  "plugins": [
    "jest"
  ],
  "rules": { ... }
}

from package.json

...
    "eslint": "6.5.1",
    "eslint-config-airbnb": "17.0.0",
    "eslint-plugin-import": "2.13.0",
    "eslint-plugin-jest": "21.18.0",
    "eslint-plugin-jsx-a11y": "6.1.1",
    "eslint-plugin-react": "7.14.2",
    "@typescript-eslint/eslint-plugin": "2.3.3",
    "@typescript-eslint/parser": "2.3.2",
...

from my vscode settings:

    "eslint.runtime": "node"

node version: v8.9.0 npm version: 5.10.0

confusion & requesting help debugging?

I expect to get the same output when running from CLI vs through the plugin (especially when I set the node version to be the same as well), but there’s clearly further differences, and maybe some other configuration I’m missing? Can I get extended debug output from the vscode extension somewhere?

The error output Failed to load plugin '@typescript-eslint' declared in 'sam-frontend/.eslintrc.js': Cannot find module '@typescript-eslint/eslint-plugin' leads me to think I had a typo or a missing package, but I’ve double checked that so many times now I’m certain that I’ve got tunnelvision here, and that the problem is somewhere else entirely. Is there a version mismatch between the different moving parts? (eslint + @typescript-eslint/eslint-plugin + node + npm)

Is it because I’m using the *.js style of configuration file? (I tried switching once to a JSON .eslintrc, but I haven’t tried all permutations of this yet).

Am i even submitting this in the right place? My gut tells me this is an extension issue, but could it be a vscode issue?

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
julian-sb1commented, Jan 24, 2020

ok, now I feel pretty stupid, turns out I was just not setting the workingDirectories! (didn’t read the documentation thoroughly 🤦‍♂ )

    "eslint.workingDirectories": ["./sam-frontend"]

with the above it works perfectly!

3reactions
dbaeumercommented, Jan 24, 2020

Good to see you found a solution. I guess you needed to run eslint in the terminal from sam-frontend as well. In the workspace folder it very likely showed the same problems. In general if you have to cd into a directory to make eslint in the terminal work you need to specify eslint.workingDirectories. There is a new value for working directories that does some auto inference which would have worked in your case as well ([{ "mode": "auto" }])

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to load plugin '@typescript-eslint' declared in '.eslintrc ...
Bug: (TypeError: Failed to load plugin '@typescript-eslint' declared in '.eslintrc.json': Class extends value undefined is not a constructor or null) #15149.
Read more >
8.0.0 Failed to load plugin '@typescript-eslint' - Stack Overflow
TypeError: Failed to load plugin '@typescript-eslint' declared in 'src.eslintrc': Class extends value undefined is not a constructor or null ...
Read more >
WEB-53184 - YouTrack
Error: Failed to load plugin '@typescript-eslint' declared in '../../../.eslintrc.json': Cannot find module '@typescript-eslint/eslint-plugin'.
Read more >
Failed to load plugin '@typescript-eslint ... - Corey Roth's Blog
I sifted through node_modules to find the project that was failing and I found the following TypeScript devDependency. I added it to my...
Read more >
typescript-eslint - Gitter
It's likely that the plugin isn't installed correctly. Try reinstalling by running the following: npm install @typescript-eslint/eslint-plugin@latest --save-dev ...
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