Open Saszr opened 2 years ago
I just ran into the same problem. This was also seen in #331
I fixed this by clearing my VS Code caches, and then restarting:
# MacOS
rm -rf $HOME/Library/Application\ Support/Code/Cache/* $HOME/Library/Application\ Support/Code/CachedData/*
I think the problem lies in the global path resolver using a stale cache value: https://github.com/stylelint/vscode-stylelint/blob/b07fb506452b720a28e0f3fb01f48fc5c27becbf/src/utils/packages/global-path-resolver.ts#L175-L180
I fixed this by clearing my VS Code caches, and then restarting
I did this, but nothing changed, the warn is still there.
I'm having this same issue on macOS 13.0.1 and also using NVM. I've installed the stylelint package locally and the VS Code Stylelint plugin works, but I still get the warning message. I've added export NODE_PATH=$(npm root --quiet -g)
to my .zshrc
file, cleared the VS Code caches and neither helped.
I'm having this same issue on Windows 11 and using fnm, i‘m using winget install OpenJS.NodeJS.LTS
install nodejs to system,solved this problem. maybe add fnm's node and npm path to environment variable can also solved this problem
I got this as well
I have the same issue.
I'm using PNPM modules.
VS Code settings I use
"stylelint.packageManager": "pnpm",
"stylelint.configFile": ".stylelintrc.js"
Warning
[Info - 08:46:00] [language-server] Registering module | module: "auto-fix"
[Info - 08:46:00] [language-server] Module registered | module: "auto-fix"
[Info - 08:46:01] [language-server] Registering module | module: "code-action"
[Info - 08:46:01] [language-server] Module registered | module: "code-action"
[Info - 08:46:01] [language-server] Registering module | module: "completion"
[Info - 08:46:01] [language-server] Module registered | module: "completion"
[Info - 08:46:01] [language-server] Registering module | module: "formatter"
[Info - 08:46:01] [language-server] Module registered | module: "formatter"
[Info - 08:46:01] [language-server] Registering module | module: "old-stylelint-warning"
[Info - 08:46:01] [language-server] Module registered | module: "old-stylelint-warning"
[Info - 08:46:01] [language-server] Registering module | module: "validator"
[Info - 08:46:01] [language-server] Module registered | module: "validator"
[Info - 08:46:01] [language-server] Starting language server
[Info - 08:46:01] [language-server] Registering handlers
[Info - 08:46:01] [language-server] Handlers registered
[Info - 08:46:01] [language-server] Language server started
[Warn - 08:46:06] [language-server] Failed to resolve global node_modules path. | packageManager: "pnpm" error: {"name":"Error","message":"Command \"pnpm\" exited with code 1.","stack":"Error: Command \"pnpm\" exited with code 1.\n at p (/Users/cherkalexander/.vscode/extensions/stylelint.vscode-stylelint-1.2.4/dist/start-server.js:70:20149)\n at ChildProcess.<anonymous> (/Users/cherkalexander/.vscode/extensions/stylelint.vscode-stylelint-1.2.4/dist/start-server.js:70:20440)\n at ChildProcess.emit (node:events:513:28)\n at ChildProcess._handle.onexit (node:internal/child_process:291:12)"}
[Warn - 08:46:06] [language-server] Failed to resolve global node_modules path. | packageManager: "pnpm" error: {"name":"Error","message":"Command \"pnpm\" exited with code 1.","stack":"Error: Command \"pnpm\" exited with code 1.\n at p (/Users/cherkalexander/.vscode/extensions/stylelint.vscode-stylelint-1.2.4/dist/start-server.js:70:20149)\n at ChildProcess.<anonymous> (/Users/cherkalexander/.vscode/extensions/stylelint.vscode-stylelint-1.2.4/dist/start-server.js:70:20440)\n at ChildProcess.emit (node:events:513:28)\n at ChildProcess._handle.onexit (node:internal/child_process:291:12)"}
Stylelint packages
"stylelint": "^15.10.2",
"stylelint-config-standard": "^34.0.0",
"stylelint-declaration-strict-value": "^1.9.2",
Pnpm version: v7.17.1
Stylelint Version: v1.2.4
Node.js Version: v16.15.1
Operating System macOS 13.0.1
If I remove stylelint.packageManager
setting, the warning goes away. But Fix all auto-fixable problems
action doesn't work for me.
I'm having this same issue on Windows 11 and using fnm, i‘m using
winget install OpenJS.NodeJS.LTS
install nodejs to system,solved this problem. maybe add fnm's node and npm path to environment variable can also solved this problem
I think this is an environment variable error. I also used the fnm tool with windows 10, and decided to install node to the system and it worked for me.
I am also receiving this error.
I believe this to be caused by a breaking change from Yarn Classic to Yarn Modern: the yarn global
command, which is used to determine the global path for node modules, was removed. Note that other command names were also changed, which may affect areas other than the one I highlighted above.
I suspect that the desired new command for the case I highlighted above is yarn config get cacheFolder
, though reading from the directory may require additional changes.
I got this as well
"dependencies": {
"postcss": "^8.4.16",
"postcss-less": "^6.0.0",
"postcss-html": "^1.6.0",
"postcss-scss": "^4.0.0",
"stylelint": "^16.2.1",
"stylelint-config-standard": "^36.0.0",
"stylelint-config-css-modules": "^4.4.0",
"stylelint-config-recess-order": "^5.0.0",
"stylelint-config-recommended-vue": "^1.5.0",
"stylelint-config-standard-scss": "^13.0.0",
"stylelint-scss": "^6.2.1"
},
How did you encounter this bug?
I have not installed the global dependencies, the plugin has successfully run the relevant configuration through the installation in the project node_modules, but it still prompts me that the global dependencies are missing.
Code Snippet
No response
Stylelint Configuration
No response
Extension Configuration
No response
Actual Behaviour
I don't understand if this is a bug or a friendly prompt. 😯
Expected Behaviour
Maybe in my case it could have done without the hint.
Logs
[Info - 6:06:19 PM] [language-server] Registering module | module: "auto-fix" [Info - 6:06:19 PM] [language-server] Module registered | module: "auto-fix" [Info - 6:06:19 PM] [language-server] Registering module | module: "code-action" [Info - 6:06:19 PM] [language-server] Module registered | module: "code-action" [Info - 6:06:19 PM] [language-server] Registering module | module: "completion" [Info - 6:06:19 PM] [language-server] Module registered | module: "completion" [Info - 6:06:19 PM] [language-server] Registering module | module: "formatter" [Info - 6:06:19 PM] [language-server] Module registered | module: "formatter" [Info - 6:06:19 PM] [language-server] Registering module | module: "old-stylelint-warning" [Info - 6:06:19 PM] [language-server] Module registered | module: "old-stylelint-warning" [Info - 6:06:19 PM] [language-server] Registering module | module: "validator" [Info - 6:06:19 PM] [language-server] Module registered | module: "validator" [Info - 6:06:19 PM] [language-server] Starting language server [Info - 6:06:19 PM] [language-server] Registering handlers [Info - 6:06:19 PM] [language-server] Handlers registered [Info - 6:06:19 PM] [language-server] Language server started [Warn - 6:06:20 PM] [language-server] Failed to resolve global node_modules path. | packageManager: "npm" error: {"errno":-2,"code":"ENOENT","syscall":"spawn npm","path":"npm","spawnargs":["config","get","prefix"],"name":"Error","message":"spawn npm ENOENT","stack":"Error: spawn npm ENOENT\n at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)\n at onErrorNT (internal/child_process.js:465:16)\n at processTicksAndRejections (internal/process/task_queues.js:80:21)"} [Warn - 6:06:20 PM] [language-server] Failed to resolve global node_modules path. | packageManager: "npm" error: {"errno":-2,"code":"ENOENT","syscall":"spawn npm","path":"npm","spawnargs":["config","get","prefix"],"name":"Error","message":"spawn npm ENOENT","stack":"Error: spawn npm ENOENT\n at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)\n at onErrorNT (internal/child_process.js:465:16)\n at processTicksAndRejections (internal/process/task_queues.js:80:21)"} [Warn - 6:06:20 PM] [language-server] Failed to resolve global node_modules path. | packageManager: "npm" error: {"errno":-2,"code":"ENOENT","syscall":"spawn npm","path":"npm","spawnargs":["config","get","prefix"],"name":"Error","message":"spawn npm ENOENT","stack":"Error: spawn npm ENOENT\n at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)\n at onErrorNT (internal/child_process.js:465:16)\n at processTicksAndRejections (internal/process/task_queues.js:80:21)\n at runNextTicks (internal/process/task_queues.js:62:3)\n at processImmediate (internal/timers.js:434:9)"} /Users/saszr/Coding/Github/rfmo/src/global.less: When linting something other than CSS, you should install an appropriate syntax, e.g. "postcss-less", and use the "customSyntax" option /Users/saszr/Coding/Github/rfmo/src/global.less: When linting something other than CSS, you should install an appropriate syntax, e.g. "postcss-less", and use the "customSyntax" option
Stylelint Version
v14.6.0
vscode-stylelint Version
v1.2.2
Node.js Version
v16.13.1
Operating System
macOS 12.0.1
Windows Subsystem for Linux
No response
Code of Conduct