Closed mcmxcdev closed 3 years ago
Did you change any of the default settings? Like setting the node runtime?
No, only using default settings. Node version in use is v14.11.0
You can find the whole codebase that is throwing the error here: https://github.com/mhatvan/markushatvan.com
Does the issue occur if you disable all other extensions in VS Code?
Just verified that it also happens with a clean VSCode insiders install. Only plugin installed is Svelte VSCode and it crashes on any file.
I cannot reproduce this unfortunately. Googling this only turned up obscure errors with packages that interact with Node on a very low level (using C++ or sth like that). So maybe this build got unlucky with some npm packages installing something that is incompatible with your Node/OS version. Does this error occur when you install an older version of the extension? You can do so by right-clicking on the installed extension and then select "Install another Version". Alternatively, wait 20 more hours, then I'll release a new version.
Yeah, I also don't find any solutions for this. Downgrading to older Svelte VSCode versions and/or an older Node version still produces this error unfortunately.
When running the project on macOS, no errors are encountered. So it is probably a Linux/Ubuntu specific issue.
I was able to find out what causes the issue!
This is my svelte.config.js
:
const sveltePreprocess = require('svelte-preprocess');
const postcss = require('./postcss.config');
const image = require('svelte-image');
const { mdsvex } = require('mdsvex');
const defaults = {
script: 'typescript',
style: 'postcss',
};
const createPreprocessors = ({ sourceMap }) => [
mdsvex(),
image({ placeholder: 'blur', optimizeRemote: true }),
sveltePreprocess({
defaults,
sourceMap,
postcss,
preserve: ['ld+json'],
}),
];
module.exports = {
createPreprocessors,
// Options for `svelte-check` and the VS Code extension
preprocess: createPreprocessors({ sourceMap: true }),
};
When I comment out the svelte-image
import and its usage in createPreprocessors
, the Svelte VSCode extension loads just fine.
Unfortunately, I cannot pinpoint why svelte-image
is causing an issue all of a sudden, the last release is back a month.
svelte-image
has a dependency on sharp
, and in one of the other issues related to this problem someone said that package caused it - maybe for you as well. As a fix: try to leave out the svelte-image
preprocessor for the svelte.config.js
and only include it for your build config.
Great that we found the culprit, thanks for the help!
The related core issue: https://github.com/lovell/sharp/issues/2356
I used your suggested fix and all good now.
Describe the bug As soon as I start VSCode, the language server crashes on initialize. I had this issue a while ago, but it went away again after some extension updates I asume, now resurfaced.
As you can see it is not related to actual file content, since it also breaks on a simple
<div>hello</div>
To Reproduce Steps to reproduce the behavior:
Expected behavior Svelte VSCode extension to work flawlessly.
Screenshots![2020-09-26_09-18](https://user-images.githubusercontent.com/16797721/94335097-578bfe80-ffd9-11ea-913a-8fb30fba3983.png)
System (please complete the following information):