Language server unable to start
Closed this issue · 6 comments
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/pikeas/.vscode/extensions/vunguyentuan.vscode-css-variables-2.3.7/server/node_modules/culori/src/index.js from /Users/pikeas/.vscode/extensions/vunguyentuan.vscode-css-variables-2.3.7/server/out/server.js not supported.
Instead change the require of index.js in /Users/pikeas/.vscode/extensions/vunguyentuan.vscode-css-variables-2.3.7/server/out/server.js to a dynamic import() which is available in all CommonJS modules.
at Function.c._load (node:electron/js2c/asar_bundle:5:13343)
at Object.<anonymous> (/Users/pikeas/.vscode/extensions/vunguyentuan.vscode-css-variables-2.3.7/server/out/server.js:31:29)
at Function.c._load (node:electron/js2c/asar_bundle:5:13343) {
code: 'ERR_REQUIRE_ESM'
}
[Error - 12:27:20 PM] Connection to server got closed. Server will not be restarted.
Looks like the 2.3.7 version of the extension is packaged with culori v2.0.3 whereas previous versions were using 0.20.1. It doesn't look like this dependency has changed in the package.json for the server project though, so maybe there's a package version issue somewhere else.
You can work around this by replacing the culori code in
.vscode\extensions\vunguyentuan.vscode-css-variables-2.3.7\server\node_modules\culori
with the 0.20.1 release of the library.
$ cat ~/.vscode/extensions/vunguyentuan.vscode-css-variables-2.3.7/server/package.json | grep culori
"culori": "0.20.1",
On my system, looks like 2.3.7 is installed with the server's copy of culori pinned to 0.20.1.
Yeah, it's the same for me as well. The code is expecting culori@0.20.1 but if you look at the version shipped in node_modules, it's 2.0.3 (on my machine)
$ cat ~/.vscode/extensions/vunguyentuan.vscode-css-variables-2.3.7/server/node_modules/culori/package.json | grep version
"version": "2.0.3",
I was able to mitigate this locally by overwriting the culori node_modules folder with the 0.20.1 release.
The easiest way to fix this until the maintainer can update the extension is to install the correct version yourself:
λ cd ~/.vscode/extensions/vunguyentuan.vscode-css-variables-2.3.7/server
λ npm i culori@0.20.1
changed 6 packages, and audited 31 packages in 1s
found 0 vulnerabilities
λ cat ~/.vscode/extensions/vunguyentuan.vscode-css-variables-2.3.7/server/node_modules/culori/package.json | grep version
"version": "0.20.1",
I can confirm that 2.3.6 worked for me, not 2.3.7 or 2.3.8