-
-
Notifications
You must be signed in to change notification settings - Fork 27
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
[Bug]: Extention is not able to locate stylelint package #281
Comments
Thanks for the bug report! Can you post more of the logs that you get when Code's run with |
I tried debugging on my windows machine via #219 but the output tab does not show logs prefixed with Debug. Let's put this on hold until I get the verbose logging working. |
@Levdbas Just copying what I added to the other issue, looks like spaces were causing a problem on Windows, so |
Hi @adalinesimonian , that worked! I attached a file containing all the log output since startup. I went through the logs but wasn't able to point out a specific line pointing us in the right direction. But maybe I missed something. for some reason the output from the resolveFromPath() and resolveFromModules() is missing from the logs probably because Right now it just says:
If you could add the output of these two methods/functions to the output tab as well it would enhance the debugging experience. |
Here's a version of the extension with the patch from #294, which should coax out any logs that we may not be getting. If it doesn't, then there's some kind of error or issue happening wherein the inner resolvers don't get a chance to execute, or throw, or perhaps some kind of unhandled promise rejection… all sorts of fun stuff. |
Thank you for your effort to get this resolved @adalinesimonian , much appreciated! I never encountered a maintainer so involved as you. :) I uninstalled the regular version and installed the vsix patched version but no luck. It doesn't give any more information then before. If there is any way in which I can help you debug this issue, let me know! |
Haha, well, I had to take some time away from work for health reasons, so I'm currently unemployed, hence why I've got all this time to work on this extension. Otherwise, who knows if I'd have the time, most open-source work is volunteered as you know. Luckily, I'm much better now, so I've been trying to nab a part-time job so that I still have time to volunteer with Stylelint. But, boy is it hard to find part-time tech work, almost everything's full-time. Anyway, enough about that!
I just noticed that your package manager configuration is set to Yarn. Are you using PnP in your project? If so, are you using the vscode-stylelint SDK? |
Hi there, I'm facing the same problem. I just wanted to provide some information that might help you solve it. I'm using Volta to install Node.js (and npm) on macOS, and the problem occurs when I launch VS Code in a normal way, like Launchpad, while it doesn't when I launch it from the terminal (with The extension version is v1.0.3, and the configuration is left at default except for The Stylelint version is v13.13.1, which is probably irrelevant. The logs when the problem occurred
The logs (with
|
In order to get debug logs while not launching Code from the terminal, you'll need to run launchctl setenv NODE_ENV development and close the terminal session. I'm not sure if you'll have to restart. Because this sets an environment variable globally, once you're done, you may need to clear the variable afterwards so that it doesn't affect other applications that may also check |
I didn't know there was such a way! Okay, here you are. The logs (with
|
It looks like errors aren't logged when module resolution throws, which I've patched in #302. Here's a copy of the extension with that patch included in it. Go ahead and install it and share what logs you get when resolution fails; I think we might finally get some answers. |
Got it, this is it 🙂 The logs (with
|
I haven't forgotten this thread but I am kinda busy at the moment. I am trying to make some room to debug this tomorrow! |
The migration guide mentions "If the extension doesn't seem to be linting any documents, make sure you have Stylelint installed." however it doesn't give me any error or warnings messages at all in VSCode, so I am unable to find out why I have no linting within VSCode since updating all related packages (stylelint & configs) & applying migration guide. Validation works for me in the CLI but not in VSCode, so I wonder... Does the extension account for In my project for example (old php app with a
|
@chalkygames123 Aha! This is the key line: it looks like when you start VS Code outside of the terminal, the extension's attempt to run npm to find out where npm's global
@fabd The resolution logic is as follows; any reference to a setting is a reference to the extension's settings in VS Code, not Stylelint's configuration file.
In any of these cases, Stylelint is only considered resolved if the resolved module has an exported So specifically in regard to your question, it should, in theory, be resolving the Stylelint package using the path of the document that the extension is attempting to lint as a starting point. So, at least if everything is working as it should, the extension should be able to resolve the Stylelint package even if it is not directly in the workspace root, whether it is deeper into the workspace or outside of it. If you are experiencing issues with resolution, I suggest running Code with |
I finally found some time to try your latest patch and got the same error as @chalkygames123. So a little background on where my files live. Installing is done via yarn in WSL.
I know its probably a very specific setup but hopefully you can help. Meanwhile I'm going to try out to remote into WSL via the WSL extention and see how that works in my day to day work. |
Agh! The error object as logged is empty, so there's no way to know exactly what went wrong, even though there's definitely something happening there. It looks like the logger wasn't properly serializing error objects, so certain information was missing when logged. I fixed this in #310, and a patched VSIX is below that contains this fix. vscode-stylelint-1.0.3-error-serialization-patch.zip
I'm guessing the CSS you're trying to lint is in your theme folder or deeper? In theory, so long as the extension is properly installed in WSL, it should work. Even if the package is installed in a subdirectory (or further out of the project), it should be able to be resolved. I'm running Windows 11 with Fedora 35 running in WSL 2, with Node installed using Volta. I decided to see if I could repro the resolution error. I created the following file structure:
And it seems to work: @chalkygames123 It looks like the error you and @Levdbas are experiencing are different, otherwise, the error that you both see would be the same. Could you copy your comment into a new issue so that we can track it as a separate bug? Thanks to both of you for your patience with this. I want to get this working for you and whoever else may also be encountering the same issues. Your help debugging this is incredibly valuable. Without it, it would be so much harder to try and figure out what's gone wrong and how to fix it. |
|
@adalinesimonian Sure! I'm happy to help. Created: #312 |
Since you mentioned Windows, I thought I'd add mention I am also running macOS. Could be related. For me VSCode is running on the host. I was trying to run stylelint 14 with a node_modules that is maintained by npm inside a Ubuntu 20.04 container. The project's root folder is just mapped to From VSCode standpoint I think it doesn't matter since it sees all the files on the host OS, so may be irrelevant. To summarize for me the issue is that running stylelint 14 via CLI was working, but in VSCode it wouldn't lint anything, and it wouldn't give me any errors or startup so I can't really tell why it wasn't active. |
@kryshac @fabd Without debug logs, there's not a whole lot I can do to figure out what's going wrong. If you wouldn't mind, could you install the patched version of the extension from #281 (comment) and run VS Code with |
I have this same problem on Windows 10. VSCode-stylelint just stopped working after the update. On my macOS it picks up the stylelint bin automatically. cmd stylelint path: C:\>C:\Users\Rolle\AppData\Roaming\npm\stylelint --version
14.0.1 Please advice. |
@adalinesimonian the problem for me was that I was opening vscode from a bash script that was executed from i3 and was open as a normal user and had no access to npm |
Can you try updating to v1.1.0 and see if it does the trick? It has a bug fix for #312 which causes resolution to error out when the package manager cannot be accessed. |
I deleted the link from npm from
|
1.1.0 Works for me! 🎉 The first 5 lines from the log fail, which is exactly what I expected since I do not have stylelint installed inside Windows.
Then the next 5 lines try to resolve Stylelint from the filesystem and does succeed.
Thanks a lot @adalinesimonian for your perseverance in this issue! |
Glad to hear it's working. Closing this issue now. Thanks for all the help with this! |
For me 1.1.0 doesn't change the situation. Not seeing any linter errors in the editor. On command line |
...missed some settings, sorry. It works now with these:
|
How did you encounter this bug?
When running this extension I run into an error where stylelint cannot load. Running via CLI does lint the code. I am running on Windows/WSL1 where Code runs on the Windows side and I run Yarn on the WSL side. Files live on the windows filesystem which WSL mounts. Installing Stylelint globally with yarn global add stylelint gives the same result which I do understand since the extention is probably unaware of the global node_modules location in the WSL file structure. Version v0.87.6 still works flawlessly though, probably since the bundled version of styellint, but since there is not a output panel for stylelint in that older version I cannot further debug this.
Current situation:
Locations:
Code Snippet
No response
Extension Configuration
Actual Behaviour
[Warn - 09:50:00] [language-server] Failed to load stylelint either globally or from the current workspace. [Info - 09:50:00] [language-server] No Stylelint found with which to lint document
Expected Behaviour
It would just lint as prior to 1.x
Stylelint Version
14.0
vscode-stylelint Version
v1.0.1
Node.js Version
v16.11
Code of Conduct
The text was updated successfully, but these errors were encountered: