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

[Bug]: Extension fails to launch "Cannot find module 'node:process'" #577

Open
1 task done
Ulisseus opened this issue Jul 31, 2024 · 0 comments
Open
1 task done

Comments

@Ulisseus
Copy link

Ulisseus commented Jul 31, 2024

How did you encounter this bug?

Pretty much fresh setup of vscode and stylelint-vscode. I have multiple node runtimes installed (trough nvm) and everything works fine when I'm using stylelint in terminal. But vscode extension fails to launch with the following error "Cannot find module 'node:process'. I suppose for some reason it uses the older node runtime (pre 14 something) but I can't find a way configure extension to use the correct node version.

Link to Minimal Reproducible Example

No response

Code Snippet

No response

Stylelint Configuration

    "extends": ["stylelint-config-standard-scss", "stylelint-config-css-modules"],
    "plugins": ["stylelint-scss"],
    "rules": {
        "selector-class-pattern": null,
        "no-descending-specificity": null,
        "scss/double-slash-comment-whitespace-inside": null,
        "keyframes-name-pattern": null,
        "scss/at-mixin-pattern": null,
        "selector-pseudo-class-no-unknown": [true, { "ignorePseudoClasses": ["global"] }]
    }
}

Extension Configuration

{ 
    "css.validate": false,
    "less.validate": false,
    "scss.validate": false,
    "stylelint.config": null,
    "stylelint.validate": [
        "css",
        "scss"
    ],
    "stylelint.snippet": [
        "css",
        "less",
        "postcss",
        "scss"
    ]
}

Actual Behaviour

Extension fails to launch because it picks up older node runtime.

Expected Behaviour

Extension should use node runtime selected by nvm. Maybe there should be a way to explicitly configure node path in the extension settings like eslint has (see eslint.runtime https://github.com/microsoft/vscode-eslint?tab=readme-ov-file#settings-options. )

Logs

[Info  - 09:05:45] [language-server] Module registered | module: "auto-fix"
[Info  - 09:05:45] [language-server] Registering module | module: "code-action"
[Info  - 09:05:45] [language-server] Module registered | module: "code-action"
[Info  - 09:05:45] [language-server] Registering module | module: "completion"
[Info  - 09:05:45] [language-server] Module registered | module: "completion"
[Info  - 09:05:45] [language-server] Registering module | module: "formatter"
[Info  - 09:05:45] [language-server] Module registered | module: "formatter"
[Info  - 09:05:45] [language-server] Registering module | module: "old-stylelint-warning"
[Info  - 09:05:45] [language-server] Module registered | module: "old-stylelint-warning"
[Info  - 09:05:45] [language-server] Registering module | module: "validator"
[Info  - 09:05:45] [language-server] Module registered | module: "validator"
[Info  - 09:05:45] [language-server] Starting language server
[Info  - 09:05:45] [language-server] Registering handlers
[Info  - 09:05:45] [language-server] Handlers registered
[Info  - 09:05:45] [language-server] Language server started
[Warn  - 09:05:48] [language-server] Could not load Stylelint from node_modules | error: {"code":"MODULE_NOT_FOUND","requireStack":["d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs","d:\\work\\customer-base\\node_modules\\stylelint\\lib\\index.cjs","d:\\Users\\spiridonov-ap\\.vscode\\extensions\\stylelint.vscode-stylelint-1.3.0\\dist\\start-server.js"],"name":"Error","message":"Cannot find module 'node:process'\nRequire stack:\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\index.cjs\n- d:\\Users\\spiridonov-ap\\.vscode\\extensions\\stylelint.vscode-stylelint-1.3.0\\dist\\start-server.js","stack":"Error: Cannot find module 'node:process'\nRequire stack:\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\index.cjs\n- d:\\Users\\spiridonov-ap\\.vscode\\extensions\\stylelint.vscode-stylelint-1.3.0\\dist\\start-server.js\n    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:934:15)\n    at Module._load (internal/modules/cjs/loader.js:779:27)\n    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)\n    at Module.require (internal/modules/cjs/loader.js:1006:19)\n    at require (internal/modules/cjs/helpers.js:88:18)\n    at Object.<anonymous> (d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs:5:17)\n    at Module._compile (internal/modules/cjs/loader.js:1125:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)\n    at Module.load (internal/modules/cjs/loader.js:982:32)\n    at Module._load (internal/modules/cjs/loader.js:823:14)"}
[Warn  - 09:05:48] [language-server] Failed to load Stylelint either globally or from the current workspace.
[Warn  - 09:05:48] [language-server] Failed to resolve Stylelint | uri: "file:///d%3A/work/customer-base/src/pages/ActionPlanPage/ui/ActionPlanPage/ActionPlan.module.scss"
[Warn  - 09:05:48] [language-server] Could not load Stylelint from node_modules | error: {"code":"MODULE_NOT_FOUND","requireStack":["d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs","d:\\work\\customer-base\\node_modules\\stylelint\\lib\\index.cjs","d:\\Users\\spiridonov-ap\\.vscode\\extensions\\stylelint.vscode-stylelint-1.3.0\\dist\\start-server.js"],"name":"Error","message":"Cannot find module 'node:process'\nRequire stack:\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\index.cjs\n- d:\\Users\\spiridonov-ap\\.vscode\\extensions\\stylelint.vscode-stylelint-1.3.0\\dist\\start-server.js","stack":"Error: Cannot find module 'node:process'\nRequire stack:\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\index.cjs\n- d:\\Users\\spiridonov-ap\\.vscode\\extensions\\stylelint.vscode-stylelint-1.3.0\\dist\\start-server.js\n    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:934:15)\n    at Module._load (internal/modules/cjs/loader.js:779:27)\n    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)\n    at Module.require (internal/modules/cjs/loader.js:1006:19)\n    at require (internal/modules/cjs/helpers.js:88:18)\n    at Object.<anonymous> (d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs:5:17)\n    at Module._compile (internal/modules/cjs/loader.js:1125:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)\n    at Module.load (internal/modules/cjs/loader.js:982:32)\n    at Module._load (internal/modules/cjs/loader.js:823:14)"}
[Warn  - 09:05:48] [language-server] Failed to load Stylelint either globally or from the current workspace.
[Info  - 09:05:48] [language-server] No Stylelint found with which to lint document | uri: "file:///d%3A/work/customer-base/src/pages/ActionPlanPage/ui/ActionPlanPage/ActionPlan.module.scss" options: {"codeAction":{"disableRuleComment":{"location":"separateLine"}},"config":null,"configFile":"","configBasedir":"","customSyntax":"","ignoreDisables":false,"packageManager":"npm","reportDescriptionlessDisables":false,"reportInvalidScopeDisables":false,"reportNeedlessDisables":false,"snippet":["css","less","postcss","scss"],"stylelintPath":"","validate":["css","scss"]}
[Warn  - 09:05:48] [language-server] Could not load Stylelint from node_modules | error: {"code":"MODULE_NOT_FOUND","requireStack":["d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs","d:\\work\\customer-base\\node_modules\\stylelint\\lib\\index.cjs","d:\\Users\\spiridonov-ap\\.vscode\\extensions\\stylelint.vscode-stylelint-1.3.0\\dist\\start-server.js"],"name":"Error","message":"Cannot find module 'node:process'\nRequire stack:\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\index.cjs\n- d:\\Users\\spiridonov-ap\\.vscode\\extensions\\stylelint.vscode-stylelint-1.3.0\\dist\\start-server.js","stack":"Error: Cannot find module 'node:process'\nRequire stack:\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs\n- d:\\work\\customer-base\\node_modules\\stylelint\\lib\\index.cjs\n- d:\\Users\\spiridonov-ap\\.vscode\\extensions\\stylelint.vscode-stylelint-1.3.0\\dist\\start-server.js\n    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:934:15)\n    at Module._load (internal/modules/cjs/loader.js:779:27)\n    at Function.f._load (electron/js2c/asar_bundle.js:5:12913)\n    at Module.require (internal/modules/cjs/loader.js:1006:19)\n    at require (internal/modules/cjs/helpers.js:88:18)\n    at Object.<anonymous> (d:\\work\\customer-base\\node_modules\\stylelint\\lib\\createStylelint.cjs:5:17)\n    at Module._compile (internal/modules/cjs/loader.js:1125:30)\n    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1155:10)\n    at Module.load (internal/modules/cjs/loader.js:982:32)\n    at Module._load (internal/modules/cjs/loader.js:823:14)"}
[Warn  - 09:05:48] [language-server] Failed to load Stylelint either globally or from the current workspace.
[Info  - 09:05:48] [language-server] No Stylelint found with which to lint document | uri: "file:///d%3A/work/customer-base/src/pages/ActionPlanPage/ui/ActionPlanPage/ActionPlan.module.scss" options: {"codeAction":{"disableRuleComment":{"location":"separateLine"}},"config":null,"configFile":"","configBasedir":"","customSyntax":"","ignoreDisables":false,"packageManager":"npm","reportDescriptionlessDisables":false,"reportInvalidScopeDisables":false,"reportNeedlessDisables":false,"snippet":["css","less","postcss","scss"],"stylelintPath":"","validate":["css","scss"]}

Stylelint Version

16.7.0

vscode-stylelint Version

1.3.0

Node.js Version

v18.20.4

Operating System

Windows Server 2016 Standard 1607

Windows Subsystem for Linux

No response

Code of Conduct

  • I agree to follow vscode-stylelint's Code of Conduct
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