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.

Failed to load the ESLint library for the document when eslint is installed by yarn

See original GitHub issue

I’m seeing Failed to load the ESLint library for the document when eslint is installed by yarn. I have configured the following -

🐍 $ yarn global add eslint
yarn global v1.1.0
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
warning Pattern ["eslint@^4.14.0"] is trying to unpack in the same destination "/Users/junger/Library/Caches/Yarn/v1/npm-eslint-4.14.0-96609768d1dd23304faba2d94b7fefe5a5447a82" as pattern ["eslint@^4.0.0"]. This could result in a non deterministic behavior, skipping.
[3/4] 🔗  Linking dependencies...
[4/4] 📃  Building fresh packages...
success Installed "eslint@4.14.0" with binaries:
      - eslint
✨  Done in 2.59s.
~/.config/yarn/global
🐯 $ ls -la /usr/local/bin/eslint
lrwxr-xr-x  1 junger  admin  75 Dec 19 15:29 /usr/local/bin/eslint -> ../../../Users/junger/.config/yarn/global/node_modules/eslint/bin/eslint.js
~/.config/yarn/global

To find the node path I did -

🐮 $ which node
/Users/junger/.nvm/versions/node/v8.9.3/bin/node

And then in settings.json set the following

"eslint.nodePath": "/Users/junger/.nvm/versions/node/v8.9.3/bin/node",

Then I receive this error message -

[Info  - 06:27:58] 
Failed to load the ESLint library for the document /Users/junger/dev/stanley/shedview/configurator/src/middleware/analytics-middleware.js

To use ESLint please install eslint by running 'npm install eslint' in the workspace folder stanley
or globally using 'npm install -g eslint'. You need to reopen the workspace after installing eslint.

Alternatively you can disable ESLint for the workspace folder stanley by executing the 'Disable ESLint' command.

Is yarn installation of eslint supported?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:13 (10 by maintainers)

github_iconTop GitHub Comments

10reactions
joshungercommented, Dec 26, 2017

Argh looks like this setting fixed it -

"eslint.packageManager": "yarn",

Maybe it could just autodetect / try both?

5reactions
mohsinhijazeecommented, Sep 10, 2021

Someone stumbling upon this problem in 2021: Add following to .vscode/settings.json

 "eslint.nodePath": ".yarn/sdks",
 "npm.packageManager": "yarn",

And also, add @yarnpkg/sdks to your dependencies

yarn add @yarnpkg/sdks --dev

And then:

yarn sdks vscode vim

Should wrap the ESLint with pnp.js supplied properly. Please restart VS code afterwards.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ESLint not working in VS Code? - Stack Overflow
If it shows Failed to load the ESLint library for the document {documentName}.js -or- if the Problems tab shows an error or a...
Read more >
Configuration Files - ESLint - Pluggable JavaScript Linter
A pluggable and configurable linter tool for identifying and reporting on patterns in JavaScript. Maintain your code quality with ease.
Read more >
eslint | Yarn - Package Manager
ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code. In many ways, it is similar to JSLint and...
Read more >
[eslint] failed to load plugin 'prettier' declared in '.eslintrc.js'
The plugin name is spelled incorrectly in an ESLint configuration file (e.g. .eslintrc). 2. If ESLint is installed globally, then make sure 'eslint-plugin- ......
Read more >
ESLint not working in VSCode? Help build a troubleshooting ...
Did you install ESLint + Plugins + Presets? ... Take a look into your eslintrc configuration file and make a list of all...
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