Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The stylelint server crashed 5 times in the last 3 minutes. The server will not be restarted. #104

Closed
multics opened this issue Apr 23, 2020 · 5 comments

Comments

@multics
Copy link

multics commented Apr 23, 2020

description

When install stylelint globally, and set stylelint.stylelintPath to the global path, stylelint server crashes when vscode starts.

info

This is the vscode version info.

Version: 1.44.0
Commit: 2aae1f26c72891c399f860409176fe435a154b13
Date: 2020-04-08T08:23:56.137Z
Electron: 7.1.11
Chrome: 78.0.3904.130
Node.js: 12.8.1
V8: 7.8.279.23-electron.0
OS: Darwin x64 19.4.0

What vscode-stylelint configuration is needed to reproduce the bug?

  "stylelint.enable": true,
  "stylelint.stylelintPath": "/Users/username/.nvm/versions/node/v14.0.0/bin/stylelint",
  "editor.codeActionsOnSave": { "source.fixAll": true },

Is this issue related to autofix? (editor.codeActionsOnSave)

No.

Which version of vscode-stylelint are you using?

0.84.0

Which version of stylelint are you using?

13.3.3

Does your issue relate to non-standard syntax (e.g. SCSS, nesting, etc.)?

no

What did you expect to happen?

globally installed stylelint should work since configuration item stylelint.stylelintPath has been provided.

What actually happened (e.g. what warnings or errors you are getting)?

vscode 'official' extension crashed

This issue has nothing to do with style lint

@multics
Copy link
Author

multics commented Apr 23, 2020

output panel of stylelint has lots of these kinds of information:

Invalid option "--stdio". Did you mean "--stdin"?
Invalid option "--client-process-id".
[Info  - 11:40:53 PM] Connection to server got closed. Server will restart.

@ota-meshi
Copy link
Member

Hi @multics.
I think that if you specify the Node module in "stylelint.stylelintPath", it will work. e.g. "stylelint.stylelintPath": "/usr/local/lib/node_modules/stylelint"
Even if "bin" is specified, it does not work.

@multics
Copy link
Author

multics commented Apr 24, 2020

Hi @ota-meshi,
Thanks for your information provided. It solves the crash problem. Now I've encountered another issue. I use a global config file stylelint.config.js at my home dir, the vscode complains it could not find the config. Together with the stylelint, I installed the config I would like to extend globally as well.

npm install -g stylelint stylelint-config-rational-order

image

Here is the config:

module.exports = {
  extends: ['stylelint-config-rational-order'],
}

BTW: command line execution has no problem.

stylelint index.css

image

div {
  font-size: large;
  color: black;
  display: block;
}

Do you have any suggestions?

Thanks very much and have a nice day!

@ota-meshi
Copy link
Member

It's probably a problem with the library global-modules used by stylelint. It seems that using nvm may not return the correct global module path.

jonschlinkert/global-modules#7

It may work if you specify the full path in config.

module.exports = {
  extends: [
    '/path/to/.../node_modules/stylelint-config-rational-order',
    // or 
    require.resolve('stylelint-config-rational-order'),
  ],
}

@multics
Copy link
Author

multics commented Apr 24, 2020

Thanks @ota-meshi

Yes, you are right. I am using nvm, and absolute path solution /absolute/path/to/.../stylelint-config-package solves the problem. Another one doesn't.

Your help is appreciated!

By the way, if this extension could be enhanced to support nvm users, the global config file would look nicer and node upgrades won't require the global config updated. That will be perfect! 😀

One more thing: Stylelint is my favorite lint tool. Thanks for your guys' contribution!❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants