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... (Windows 10, WSL)

See original GitHub issue

This works fine for me in macOS. I’m having this issue in Windows:

[Info  - 8:46:29 PM] ESLint server stopped.
[Info  - 8:46:30 PM] ESLint server running in node v8.9.3
[Info  - 8:46:30 PM] ESLint server is running.
[Info  - 8:46:30 PM] Failed to load the ESLint library for the document Untitled-1
To use ESLint for single JavaScript file install eslint globally using 'npm install -g eslint'.
If you are using yarn or pnpm instead of npm set the setting `eslint.packageManager` to either `yarn` or `pnpm`
You need to reopen VS Code after installing eslint.

Repro steps:

Setup WSL and environment

  1. Enable WSL
  2. Install an Ubuntu version from the Windows Store
    👇 in Ubuntu
  3. Go through setup; Install Node.js and npm LTS
  4. Modify npm prefix to use path owned by me and not root
  5. Install eslint globally (npm -g i eslint)
  6. Add .eslintrc file to ~/
    👇 back in Windows
  7. Install VS Code Stable
  8. Open VS Code
    👇 in VS Code

Setup VS Code

  1. Install ESLint extension (dbaeumer.vscode-eslint)
  2. View > Command Palette… > Terminal: Select Default Shell > WSL Bash

Final steps

  1. Close VS Code; Open VS Code (via Windows taskbar shortcut / start menu)
  2. File > New File
  3. View > Command Palette… > Change Language Mode > JavaScript
  4. View > Output
  5. Select ESLint in output provider list
  6. Output: See log at beginning of this post
  7. View > Terminal
  8. Execute the following commands:

node -v && npm -v

v10.15.0
6.4.1

npm -g prefix

/home/jesse/.npm-global

npm -g ls --depth 0

/home/jesse/.npm-global/lib
└── eslint@5.13.0

which eslint

/home/jesse/.npm-global/bin/eslint

eslint -v

v5.13.0

Do I need to do something else?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jsejcksncommented, May 6, 2019

@dbaeumer So I will need to install another extension before being able to use ESLint in Windows? I’m confused.

Will you please elaborate here what steps will be needed (starting from a fresh Windows 10 installataion) to get ESLint working in VS Code through WSL?

0reactions
dbaeumercommented, May 7, 2019

@jsejcksn A good documentation on how to use this is here: https://code.visualstudio.com/docs/remote/wsl#_getting-started

The benefit of this approach is that not only the ESLint runs in WSL but also language support and debugging. So it is a more holistic solution then only running ESLint in WSL.

Please note that the general WSL support in VS Code is currently only available in Insider. But it will come to stable.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Failed to load the ESLint library for the document... ...
Setup WSL and environment · Enable WSL · Install an Ubuntu version from the Windows Store in Ubuntu · Go through setup; Install...
Read more >
ESLint not working in VS Code?
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 >
Install Node.js on Windows Subsystem for Linux (WSL2)
A guide to help you get your Node.js development environment set up on Windows Subsystem for Linux (WSL).
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 on WSL not work when mount point '/mnt/c' is ...
Go to Settings > Language & Frameworks > Javascript > Code Quality Tools > ESLint · uncheck "Enable".
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