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

Cannot find module /root/.vscode-server/extensions/stylelint.vscode-stylelint-0.87.4 #243

Closed
faisalrehmanlums opened this issue Sep 30, 2021 · 2 comments · Fixed by #244
Closed
Assignees
Labels
pr: dependencies relates to dependencies type: bug a problem with a feature or rule

Comments

@faisalrehmanlums
Copy link

New Error in 0.87.4

Details:

Error: Cannot find module '/root/.vscode-server/extensions/stylelint.vscode-stylelint-0.87.4/dist/template-parse' Require stack: - /root/.vscode-server/extensions/stylelint.vscode-stylelint-0.87.4/dist/server.js at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15) at Function.Module._load (internal/modules/cjs/loader.js:725:27) at Module.require (internal/modules/cjs/loader.js:952:19) at require (internal/modules/cjs/helpers.js:88:18) at cDn (/root/.vscode-server/extensions/stylelint.vscode-stylelint-0.87.4/dist/server.js:2605:8383) at TSr (/root/.vscode-server/extensions/stylelint.vscode-stylelint-0.87.4/dist/server.js:232:14230) at s (/root/.vscode-server/extensions/stylelint.vscode-stylelint-0.87.4/dist/server.js:2496:47700) at Object.onattribute (/root/.vscode-server/extensions/stylelint.vscode-stylelint-0.87.4/dist/server.js:2496:47116) at yi.onattribend (/root/.vscode-server/extensions/stylelint.vscode-stylelint-0.87.4/dist/server.js:2494:18081) at jt._stateInAttributeValueDoubleQuotes (/root/.vscode-server/extensions/stylelint.vscode-stylelint-0.87.4/dist/server.js:2494:3083)

@adalinesimonian adalinesimonian self-assigned this Sep 30, 2021
@adalinesimonian adalinesimonian added the status: needs investigation triage needs further investigation label Sep 30, 2021
@adalinesimonian
Copy link
Member

Initial investigation: problematic line is in postcss-html:

style.syntax = loadSyntax(opts, __dirname);

loadSyntax is from postcss-syntax. __dirname is passed to the function as id:

function loadSyntax (opts, id) {
	const cssSyntax = getSyntax("css", opts);
	const modulePath = id + "/template-" + (cssSyntax.parse.name === "safeParse" ? "safe-" : "") + "parse";

Yet another case of this problematic require pattern from #237 and #239.

If a package is passing __dirname to loadSyntax, it already knows what file needs to be imported by postcss-syntax. Ergo, there is no reason why it shouldn't be able to just pass the module itself instead of a path. This solution would completely avoid this problem.

postcss-html and postcss-syntax are completely unmaintained, there hasn't been an update or even a commit in 2-3 years. I'll make a fix in a fork as I did for postcss-syntax. I don't know if we'll still have any dependencies on postcss-html in stylelint 14. If we don't, great. If we do, then perhaps we can publish a scoped package? At least there'd be a maintained package then.

@adalinesimonian adalinesimonian added type: bug a problem with a feature or rule upstream relates to an upstream package and removed status: needs investigation triage needs further investigation labels Sep 30, 2021
@adalinesimonian
Copy link
Member

Pushed out v0.87.5 with a fix for this bug.

@adalinesimonian adalinesimonian added pr: dependencies relates to dependencies Fixed and removed upstream relates to an upstream package labels Oct 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: dependencies relates to dependencies type: bug a problem with a feature or rule
Development

Successfully merging a pull request may close this issue.

2 participants