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

Extension crashed caused by dependencies issue #2341

Closed
aidilrx04 opened this issue Apr 19, 2024 · 2 comments
Closed

Extension crashed caused by dependencies issue #2341

aidilrx04 opened this issue Apr 19, 2024 · 2 comments

Comments

@aidilrx04
Copy link

aidilrx04 commented Apr 19, 2024

Describe the bug

VSCode extension crashed: The Svelte server crashed 5 times in the last 3 minutes. The server will not be restarted.

Reproduction

Create svelte project: npm create svelte@latest project

┌ Welcome to SvelteKit!

◇ Which Svelte app template?
│ Skeleton project

◇ Add type checking with TypeScript?
│ Yes, using TypeScript syntax

◇ Select additional options (use arrow keys/space bar)
│ none

└ Your project is ready!

install the dependencies
open the project in vscode with Svelte for VS Code enabled

Expected behaviour

The extension should work perfectly fine

System Info

  • OS: Windows 10
  • IDE: VSCode v1.88.1
  • CPU architecure: ia32

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

Heres the log for the first error since all three errors have the same value:

Initialize language server at  file:///c%3A/Users/xxxx/Desktop/projects/batu
Initialize new ts service at  c:/Users/xxxx/Desktop/projects/batu/tsconfig.json
Trying to load configs for c:/Users/xxxx/Desktop/projects/batu
Error while loading config at  c:\Users\xxxx\Desktop\projects\batu\svelte.config.js
Error: Cannot find module @rollup/rollup-win32-x64-msvc. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at requireWithFriendlyError (C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js:59:9)
    at Object.<anonymous> (C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js:68:76)
    ... 2 lines matching cause stack trace ...
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at Module._load (node:internal/modules/cjs/loader:967:12)
    at c._load (node:electron/js2c/node_init:2:13672)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:171:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
  [cause]: Error: Cannot find module '@rollup/rollup-win32-x64-msvc'
  Require stack:
  - C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js
      at Module._resolveFilename (node:internal/modules/cjs/loader:1084:15)
      at Module._load (node:internal/modules/cjs/loader:929:27)
      at c._load (node:electron/js2c/node_init:2:13672)
      at Module.require (node:internal/modules/cjs/loader:1150:19)
      at require (node:internal/modules/cjs/helpers:119:18)
      at requireWithFriendlyError (C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js:41:10)
      at Object.<anonymous> (C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js:68:76)
      at Module._compile (node:internal/modules/cjs/loader:1271:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1326:10)
      at Module.load (node:internal/modules/cjs/loader:1126:32) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      'C:\\Users\\xxxx\\Desktop\\projects\\batu\\node_modules\\.pnpm\\rollup@4.14.3\\node_modules\\rollup\\dist\\native.js'
    ]
  }
}
Found svelte.config.js but there was an error loading it. Using https://github.com/sveltejs/svelte-preprocess as fallback
SnapshotManager File Statistics:
Project files: 9
Svelte files: 1
From node_modules: 0
Total: 9
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

Error: Cannot find module @rollup/rollup-win32-x64-msvc. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at requireWithFriendlyError (C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js:59:9)
    at Object.<anonymous> (C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js:68:76)
    ... 2 lines matching cause stack trace ...
    at Module.load (node:internal/modules/cjs/loader:1126:32)
    at Module._load (node:internal/modules/cjs/loader:967:12)
    at c._load (node:electron/js2c/node_init:2:13672)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:171:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25) {
  [cause]: Error: Cannot find module '@rollup/rollup-win32-x64-msvc'
  Require stack:
  - C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js
      at Module._resolveFilename (node:internal/modules/cjs/loader:1084:15)
      at Module._load (node:internal/modules/cjs/loader:929:27)
      at c._load (node:electron/js2c/node_init:2:13672)
      at Module.require (node:internal/modules/cjs/loader:1150:19)
      at require (node:internal/modules/cjs/helpers:119:18)
      at requireWithFriendlyError (C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js:41:10)
      at Object.<anonymous> (C:\Users\xxxx\Desktop\projects\batu\node_modules\.pnpm\rollup@4.14.3\node_modules\rollup\dist\native.js:68:76)
      at Module._compile (node:internal/modules/cjs/loader:1271:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1326:10)
      at Module.load (node:internal/modules/cjs/loader:1126:32) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      'C:\\Users\\xxxx\\Desktop\\projects\\batu\\node_modules\\.pnpm\\rollup@4.14.3\\node_modules\\rollup\\dist\\native.js'
    ]
  }
}

Node.js v18.18.2
[Info  - 1:30:09 AM] Connection to server got closed. Server will restart.
true
@aidilrx04 aidilrx04 added the bug Something isn't working label Apr 19, 2024
@jasonlyu123 jasonlyu123 added upstream and removed bug Something isn't working labels Apr 22, 2024
@jasonlyu123
Copy link
Member

This error is because the vite-preprocessor from your svelte.config.js loaded vite and then rollup. The unhandled promise is probably out of our control and we can't handle it without catching all the unhandled promise rejection, which hides problems so I am not sure if this is what we want to do.

As for the error itself, this sounds like your node.js installation is in 32-bit but your VSCode is in 64-bit. You install the dependencies with 32-bit node.js but the VSCode uses its bundled 64-bit node.js which requires @rollup/rollup-win32-x64-msvc instead of @rollup/rollup-win32-ia32-msvc. Can you check if this is the case? If it is, try reinstalling 64-bit node.js and reinstall the dependencies.

@aidilrx04
Copy link
Author

Oops, looks like I have installed the wrong version of NodeJS.
While my VSCode is x64, my NodeJS is running on ia32. After reinstalling the correct version, quick run of the reproduction solved the issue.
Thanks @jasonlyu123 for the insight

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants