Closed Beatusvir closed 5 years ago
Quitting VSCode and opening it again fixed this issue for me.
No luck yet, ended up removing both "plugins": ["react"]
and "extends": "airbnb"
It seems vscode-eslint only find node_modules from project root. So if your dir like project/admin/
, it will not find project/admin/node_modules/eslint-plugin-react
.
Hmm.. I didn't test that. I'll try that asap! Thanks @ustccjw
This configuration makes the language server running eslint crash. Need to find out why:
channel closed: Error: channel closed
at ChildProcess.target.send (internal/child_process.js:509:16)
at IPCMessageWriter.write (C:\Users\dirkb\.vscode\extensions\dbaeumer.vscode-eslint-0.10.14\node_modules\vscode-languageclient\node_modules\vscode-jsonrpc\lib\messageWriter.js:34:22)
at Object.connection.sendNotification (C:\Users\dirkb\.vscode\extensions\dbaeumer.vscode-eslint-0.10.14\node_modules\vscode-languageclient\node_modules\vscode-jsonrpc\lib\main.js:211:27)
at Object.result.didChangeConfiguration (C:\Users\dirkb\.vscode\extensions\dbaeumer.vscode-eslint-0.10.14\node_modules\vscode-languageclient\lib\main.js:56:71)
at LanguageClient.onDidChangeConfiguration (C:\Users\dirkb\.vscode\extensions\dbaeumer.vscode-eslint-0.10.14\node_modules\vscode-languageclient\lib\main.js:501:28)
at LanguageClient.<anonymous> (C:\Users\dirkb\.vscode\extensions\dbaeumer.vscode-eslint-0.10.14\node_modules\vscode-languageclient\lib\main.js:487:81)
at e.invoke (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\pluginHostProcess.js:7:14035)
at e.fire (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\pluginHostProcess.js:7:15488)
at e._acceptConfigurationChanged (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\pluginHostProcess.js:15:18102)
at t.e.handle (c:\Program Files (x86)\Microsoft VS Code\resources\app\out\vs\workbench\node\pluginHostProcess.js:15:12835)
Actual it looks like the process is not crashing. Looks like babel eslint calls process.exit() :-(
I also noticed that I receive quite some npm install errors when installing the provided config using npm version 2.14.12.
Here is what I see on npm install
npm WARN package.json name@ No description
npm WARN package.json name@ No repository field.
npm WARN package.json name@ No README data
npm WARN package.json name@ No license field.
npm WARN peerDependencies The peer dependency eslint@<2.3.0 included from babel-eslint will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency react@>=0.11.0 || ^0.14.0-rc included from react-hot-api will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install the latest version of pug instead of jade
npm WARN deprecated graceful-fs@2.0.3: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs@^4.0.0 as soon as possible.
npm WARN optional dep failed, continuing fsevents@1.0.11
npm ERR! Windows_NT 10.0.14322
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.2.6
npm ERR! npm v2.14.12
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package eslint@2.8.0 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer eslint-config-airbnb@6.2.0 wants eslint@^2.4.0
npm ERR! peerinvalid Peer babel-eslint@5.0.4 wants eslint@<2.3.0
npm ERR! Please include the following file with any support request:
npm ERR! P:\mseng\VSCode\Playgrounds\linters\npm-debug.log
@Beatusvir do you see the same or does this install for you without problems.
@ustccjw I'm experiencing a similar issue. I have multiple node projects inside of a root directory, each with their own npm_modules folder. Have you seen any solutions to the this use case?
Same problem.
package.json
{
"devDependencies": {
"babel-core": "^6.7.7",
"babel-eslint": "^6.0.4",
"babel-loader": "^6.2.4",
"babel-preset-react": "^6.5.0",
"eslint": "^2.8.0",
"eslint-loader": "^1.3.0",
"eslint-plugin-react": "^5.0.1",
"html-webpack-plugin": "^2.16.0",
"webpack": "^1.13.0",
"webpack-dev-server": "^1.14.1"
}
}
.eslintrc
{"parser": "babel-eslint",
"plugins": ["react"],
"ecmaFeatures": {
"jsx": true
},
"env": {
"browser": true,
"node": true
},
"extends": ["eslint:recommended", "plugin:react/recommended"]
}
file structure
project
│ README.md
│ index.html
├───app
│ │ index.html
│ │ index.js
│ │ ...
└───node_modules
│ ...
So I only have one node_modules folder and it's in the root dir.
eslint via command line works fine on /app/index.js
I just get the error in VSCode
I also get it if I don't include babel-eslint
The only error I get doing npm install
is about fsevent, which is only for OS X, I think.
Can everything related to eslint be installed globally?
@yudhir Yeah I believe, the problem is when you need to customize your settings per project basis, which you will sooner than later, hence something like eslint plugins, configs and extensions are usually installed locally and eslint globally.
These are my dev dependencies if it helps
"devDependencies": {
"babel-eslint": "^6.0.4",
"babel-preset-es2015": "^6.6.0",
"babel-preset-react": "^6.5.0",
"babelify": "^7.3.0",
"browserify": "^13.0.0",
"eslint": "^2.9.0",
"eslint-config-airbnb": "^8.0.0",
"eslint-plugin-import": "^1.6.1",
"eslint-plugin-jsx-a11y": "^1.0.4",
"eslint-plugin-react": "^5.0.1",
"gulp": "^3.9.1",
"gulp-uglify": "^1.5.3",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.7.0"
},
eslintrc
{
"plugins": [
"react"
],
"env": {
"browser": true,
"node": true
},
"extends": "airbnb",
"rules": {
"no-console": "off",
"react/jsx-closing-bracket-location": [
1,
"after-props"
],
"padded-blocks": "off",
"indent": "off"
}
}
I have only recently begin developing on the web and loved that it is getting organized . I configured vs code with Eslint , Typings ,Task runner etc Docs I have eslint installed it globally ,locally and the vsCode Extension as well. I came to the interweb seeing the same error but got eventually solved.
Random idea on multiple Project : have something change the single eslintrc , to your configuration when running that part of project. (gulp , webpack maybe)
@malchak the multiple project problem is discussed here: https://github.com/Microsoft/vscode-eslint/issues/32
Running the configuration in a terminal provided in comment https://github.com/Microsoft/vscode-eslint/issues/48#issue-139696159 results in:
Error: Cannot find module 'estraverse-fb'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at monkeypatch (P:\mseng\VSCode\Playgrounds\linters\node_modules\babel-eslint\index.js:59:32)
at Object.exports.parse (P:\mseng\VSCode\Playgrounds\linters\node_modules\babel-eslint\index.js:385:5)
at parse (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\eslint.js:609:27)
at EventEmitter.module.exports.api.verify (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\eslint.js:749:19)
at processText (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\cli-engine.js:257:31)
at processFile (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\cli-engine.js:292:18)
at executeOnFile (P:\mseng\VSCode\Playgrounds\linters\node_modules\eslint\lib\cli-engine.js:676:23)
The process.exit happens in babel-eslint\index.js#388.
Looks like that if you use eslint > 2.x you need babel-eslint > 6. See https://github.com/babel/babel-eslint which is not the case in the dependencies listed in comment https://github.com/Microsoft/vscode-eslint/issues/48#issue-139696159
Setting up the right dependencies makes this work. However ESLint should detect this and handle this more gracefully. Ending in this wired error is not user friendly
Thanks @dbaeumer I'm gonna try it right now
close + open window solves it for me.
Have this issue also - VC v1.4, plugin v0.10.18.
Running local eslint from terminal works correctly:
./node_modules/eslint/bin/eslint.js src/js/game/game.js
I do not have eslint installed globally.
Visual Studio Code reports this error: "Cannot find module 'eslint-config-airbnb' Referenced from: /Users/Nanda/Work/games/glitchspace/.eslintrc.json"
I've tried restarting Visual Studio code and completely wiping then re-installing node_modules. No luck. Dependencies:
"devDependencies": {
"eslint": "^3.3.1",
"eslint-config-airbnb": "^10.0.1",
"eslint-plugin-import": "^1.14.0",
"eslint-plugin-jsx-a11y": "^2.1.0",
"eslint-plugin-react": "^6.1.2",
"gulp": "3.9.1",
"gulp-buffer": "0.0.2",
"gulp-concat-css": "2.3.0",
"gulp-livereload": "3.8.1",
"gulp-rename": "1.2.2",
"gulp-sourcemaps": "1.6.0",
"gulp-uglify": "1.5.4",
"gulp-util": "3.0.7",
"gulp-zip": "3.2.0",
"handlebars": "4.0.5",
"rollup-stream": "1.11.0",
"vinyl-buffer": "1.0.0",
"vinyl-source-stream": "1.1.0"
}
.eslintrc.json:
{
"extends": "airbnb"
}
Any ideas?
I'm having a similar. Here's my .eslintrc which is in the root folder of my project:
{
"extends": [
"../shared_configuration/shared_linters/eslintrc"
]
}
The shared_linters
folder contains its own node_modules
with all of the eslint plugin modules.
Setting the eslint.nodePath
setting to the absolute path of the eslint module within shared_linters
and that fixed it for me.
Keeping as feature request due to https://github.com/Microsoft/vscode-eslint/issues/48#issuecomment-221884230
Sounds a bit like https://github.com/walmartlabs/eslint-config-defaults/issues/38. I think I have the same problem. I have eslint installed globsally and locally in my project. eslint seems to work only with the local instalation, e.g.
.\node_modules.bin\eslint --c jsconfig.eslintrc.yml src
calling it globally you will get:
eslint --c jsconfig.eslintrc.yml src Cannot find module 'eslint-config-walmart/rules/eslint/node/on' Referenced from: C:\Users\micha\Sources\apps\3delectron\jsconfig.eslintrc.yml Error: Cannot find module 'eslint-config-walmart/rules/eslint/node/on' Referenced from: C:\Users\micha\Sources\apps\3delectron\jsconfig.eslintrc.yml at ModuleResolver.resolve (C:\Users\micha\AppData\Roaming\npm\node_modules\esl
@merdmann ESlint npm module requires itself and all plugins either being installed locally or globally. Mixing doesn't work.
You do not need to install everything globally. Check this:
npm i -g eslint-config-airbnb-standard
eslint -v
Here is the guide
@doasync this looks to me like both eslint and eslint-config-airbnb-standard are installed globally. Am I missing something ?
@dbaeumer No, just install eslint-config-airbnb-standard
, no need for eslint
itself, it's bundled inside with all the plugins. And when you run eslint -v
after installing the module, you are using that featured version from it. It's convenient in some situations.
No, this will not work for the eslint extension since it doesn't shell out to eslint on the terminal. For performance reasons it loads the eslint npm module directly which it will not find since it is buried into eslint-config-airbnb-standard
So for this setup you need to install both eslint-config-airbnb-standard
and eslint
either globally or locally
I was facing the same issue,
probably because of eslint installation, eslint was installed globally on my system and all dependencies were installed as dev-dependency. so what I did, simply removed the eslint from global
npm uninstall -g eslint
and install eslint locally
npm i eslint --save-dev
then run this(mac or Linux)
./node_modules/.bin/eslint --init
for windows
.\node_modules\.bin\eslint --init
hope this will fix your problem
@anks333 ESLint in general (the command line version as well) requires that ESLint and all extension are either installed globally or locally. You can't mix the installation scope.
@dbaeumer Yes, you are right. That's why I created only one package for Airbnb preset eslint-config-airbnb-bundle, which can be installed globally or locally. You will get eslint
command at once and it will support Airbnb config by default.
I was facing the same issue, probably because of eslint installation, eslint was installed globally on my system and all dependencies were installed as dev-dependency. so what I did, simply removed the eslint from global
npm uninstall -g eslint
and install eslint locallynpm i eslint --save-dev
then run this(mac or Linux)
./node_modules/.bin/eslint --init
for windows
.\node_modules\.bin\eslint --init
hope this will fix your problem
Thank's worked for me!
The describe improvements have happened a while ago. See https://github.com/Microsoft/vscode-eslint/blob/master/client/src/extension.ts#L617
I will close this issue since from an extension point of view no further work is needed.
I've been trying to solve this for a couple of days and well... I wouldn't be asking if I fixed it :smile:.
I deleted every package from global (except for webpack and webpack-dev-server).
I ran
npm i eslint eslint-plugin-react eslint-config-airbnb babel-eslint -D
and all of them appear innode_modules
andpackage.json
.If I run
node_modules\.bin\eslint file_name.jsx
the command works just fine, using both the plugin and the config.packages.json
.eslintrc
Any tips on debugging this?