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

vscode-stylelint v1.4.0 "Error [ERR_MODULE_NOT_FOUND]: Cannot find module", with valid stylelint.config.mjs working @ cmd line? #601

Open
pgnd opened this issue Aug 30, 2024 · 0 comments

Comments

@pgnd
Copy link

pgnd commented Aug 30, 2024

i have a vscode project

cat project.json
	...
	{
		"name": "myProj",
		"rootPath": "/home/dev/vscode/myProj.code-workspace",
		"paths": [],
		"tags": [],
		"enabled": true
	},
	...

cat /home/dev/vscode/myProj.code-workspace
	{
	    "folders": [
	        {
	            "path": "/web/wp"
	        }
	    ],
	...

within that project path, I've a customTheme folder

/path/to/my.app/web/app/themes/myTheme

in that folder

yarn -v
	4.4.1
yarn info --name-only | grep stylelint
	├─ stylelint-config-standard-scss@npm:13.1.0
	├─ stylelint-config-standard@npm:36.0.1
	├─ stylelint-no-unsupported-browser-features@npm:8.0.1
	├─ stylelint-scss@npm:6.5.1
	├─ stylelint-webpack-plugin@npm:5.0.1
	├─ stylelint@npm:16.9.0

my stylelint config file is esm format, stylelint.config.mjs.

stylelint exec works as expected

yarn stylelint --formatter verbose --color --cache --cache-location /var/lib/wwwrun/.stylelintcache --custom-syntax postcss-scss '**/*.scss'

	...
	0 problems found

in vscode,

Version: 1.92.2
Release: 24228
Commit: 21b1e2955ddda36eeba3a94e643128e465285b93
Date: 2024-08-15T18:27:27.910Z
Electron: 30.1.2
ElectronBuildId: undefined
Chromium: 124.0.6367.243
Node.js: 20.14.0
V8: 12.4.254.20-electron.0
OS: Linux x64 6.10.6-200.fc40.x86_64

i've installed vscode-stylelint

Name: Stylelint
Id: stylelint.vscode-stylelint
Description: Official Stylelint extension for Visual Studio Code
Version: 1.4.0
Publisher: stylelint
VS Marketplace Link: https://open-vsx.org/vscode/item?itemName=stylelint.vscode-stylelint

in settings.json,

	"stylelint.codeAction.disableRuleComment": {
		"location": "sameLine"
	},
	"stylelint.configFile": "my.app/web/app/themes/myTheme/stylelint.config.mjs",
	"stylelint.packageManager": "yarn",
	"stylelint.validate": [
		"css",
		"scss"
	],

on open of any .scss file in vscode, i get dialog

Error [ERR_MODULE_NOT_FOUND]:
Cannot find module '/path/to/my.app/web/app/themes/myTheme/.yarn/__virtual__/stylelint-scss-virtual-e12ef310f6/10/var/lib/wwwrun/.yarn/berry/cache/stylelint-scss-npm-6.5.1-0b7384976f-10c0.zip/node_modules/stylelint-scss/src/index.js'
imported from /var/lib/wwwrun/.yarn/berry/cache/stylelint-npm-16.9.0-70b16f0101-10c0.zip/node_modules/stylelint/lib/utils/dynamicImport.cjs
     at finalizeResolution (node:internal/modules/esm/resolve:265:11)
     at moduleResolve (node:internal/modules/esm/resolve:940:10)
     at defaultResolve (node:internal/modules/esm/resolve:1164:11)
     at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)
     at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)
     at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)
     at ModuleLoader.import (node:internal/modules/esm/loader:315:34)
     at defaultImportModuleDynamically (node:internal/modules/esm/utils:194:31)
     at importModuleDynamicallyCallback (node:internal/modules/esm/utils:216:12)
     at dynamicImport (/var/lib/wwwrun/.yarn/berry/cache/stylelint-npm-16.9.0-70b16f0101-10c0.zip/node_modules/stylelint/lib/utils/dynamicImport.cjs:16:87)

unplugging, to check

yarn unplug stylelint-scss
ls -al .yarn/unplugged/stylelint-scss-virtual-e12ef310f6/node_modules/stylelint-scss/src/index.js
	-rw-r--r--+ 1 wwwrun www 300 Jun 22  1984 .yarn/unplugged/stylelint-scss-virtual-e12ef310f6/node_modules/stylelint-scss/src/index.js

what add'l/changed config is needed here ?

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

1 participant