continuedev / continue

⏩ Continue is the leading open-source AI code assistant. You can connect any models and any context to build custom autocomplete and chat experiences inside VS Code and JetBrains
https://docs.continue.dev/
Apache License 2.0
18.22k stars 1.45k forks source link

"node_sqlite3.node is not a valid Win32 application" on Windows on ARM64 #839

Open ktos opened 8 months ago

ktos commented 8 months ago

Before submitting your bug report

Relevant environment info

- OS: Windows 11 [Version 10.0.22631.3085], ARM64
- Continue: v0.8.11 (but the same problem is in v0.9.58)
- IDE: VSCode 1.86.1

Description

After just installing the current version of continue (and pre-release, the same problem) and opening its window, the "clock" icon stays forever and nothing more happens, but I finally managed to find the appropriate VSCode log section where there is an error message:

2024-02-09 23:31:33.438 [error] Error: \\?\c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\build\Release\node_sqlite3.node is not a valid Win32 application.
\\?\c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\build\Release\node_sqlite3.node
    at process.func [as dlopen] (node:electron/js2c/asar_bundle:2:2131)
    at Object.<anonymous> (node:internal/modules/cjs/loader:1403:18)
    at Object.func [as .node] (node:electron/js2c/asar_bundle:2:2131)
    at Module.load (node:internal/modules/cjs/loader:1173:32)
    at node:internal/modules/cjs/loader:1014:12
    at Function.<anonymous> (node:electron/js2c/asar_bundle:2:13327)
    at Function.l._load (c:\Users\ktos\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:173:5635)
    at Function.r._load (c:\Users\ktos\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:170:29791)
    at Function.t._load (c:\Users\ktos\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\workbench\api\node\extensionHostProcess.js:135:35292)
    at Module.require (node:internal/modules/cjs/loader:1197:19)
    at h (c:\Users\ktos\AppData\Local\Programs\Microsoft VS Code\resources\app\out\vs\loader.js:4:647)
    at bindings (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:45868:52)
    at ../../core/node_modules/sqlite3/lib/sqlite3-binding.js (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:45940:41)
    at __require (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:13:51)
    at ../../core/node_modules/sqlite3/lib/sqlite3.js (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:45990:20)
    at __require (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:13:51)
    at ../../core/indexing/docs/db.ts (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:93109:30)
    at __init (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:10:56)
    at ../../core/indexing/docs/index.ts (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:99781:5)
    at __init (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:10:56)
    at src/debugPanel.ts (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:163096:5)
    at __init (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:10:56)
    at src/commands.ts (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:163482:5)
    at __init (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:10:56)
    at src/activation/activate.ts (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:171636:5)
    at __init (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:10:56)
    at c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:171683:89
    at dynamicImportAndActivate (c:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\extension.js:171683:53)

The file "node_sqlite3.node" referenced there is actually a x86-64 DLL, not an ARM64 DLL, so I believe the problem may lay in there:

C:\Users\ktos\.vscode\extensions\continue.continue-0.8.11-win32-arm64\out\build\Release>file node_sqlite3.node
node_sqlite3.node: PE32+ executable (DLL) (GUI) x86-64, for MS Windows, 7 sections

A bit related to the #724 where I asked for Win32-ARM64 support related to the esbuild - the pre-release version v0.9.8 was behaving very similarly but I couldn't pinpoint the actual error message until today.

To reproduce

No response

Log output

No response

DanielYzd commented 6 months ago

How can I solve the same problem I encountered?

q479902964 commented 5 months ago

the same problem +1

permpkin commented 5 months ago

Looks to be an issue when building sqlite3 and onnxruntime-node, Same issue occurs for me on Apple silicon, Solution for me was to run the following ( the same approach should also work on W11 ARM as well )...

# change to plugin directory
cd ~/.vscode/extensions/continue.continue-*

# remove sqlite3 and onnxruntime libraries
npm uninstall sqlite3 onnxruntime-node

# reinstall with targetet architecture flags 
npm install sqlite3 onnxruntime-node --build-from-source --target_arch=arm64 --fallback-to-build

# copy onnxruntime binaries to output folders
cp ./node_modules/libonnxruntime.1.17.3.dylib ./bin/napi-v3/darwin/arm64/libonnxruntime.1.17.3.dylib
cp ./node_modules/onnxruntime_binding.node ./bin/napi-v3/darwin/arm64/onnxruntime_binding.node

# copy sqlite binary to build output folder
cp ./node_modules/sqlite3/build/Release/node_sqlite3.node ./out/build/Release/node_sqlite3.node
dschonholtz commented 3 months ago

Relevant stack overflow post: https://stackoverflow.com/questions/72553650/how-to-get-node-sqlite3-working-on-mac-m1

Since this is arm specific and a problem with node-pre-gyp from what I can tell, I think we should update the title of this issue, as it is not actually about windows. Maybe to: "SQLite does not install correctly on arm64 systems."

I was able to fix this by running: npm rebuild sqlite3 --build-from-source --target_arch=arm64 --fallback-to-build I'm not using onnx right now but I'm guessing I would have to do the same thing there.

in the extensions/vscode folder after otherwise installing the dependencies. I didn't have to copy the build output into the output folders from what I can tell? it seems that that happened when I ran the vscode debug process.

This is a manual work around I believe due to an old gyp version here as described in this SO post. so maybe we can mitigate this by upgrading node-pre-gyp? I'm not sure though

theNailz commented 3 months ago

Same error for Win11 x64.

The file C:\Users\me\AppData\Roaming\JetBrains\GoLand2024.1\plugins\continue-intellij-extension\core\build\Release\node_sqlite3.node is the arm32 version. I 'fixed' it (this error, but processing seems to hang) by copying the right binary from C:\Users\me\AppData\Roaming\JetBrains\GoLand2024.1\plugins\continue-intellij-extension\core\win32-x64.

Now it's stuck at "Completed indexing chunks", with no errors in the core.log. Hope this might give anyone a clue or point of reference.

I'm bummed that my first experience with Continue is a bad experience. It seemed promising.

sestinj commented 3 months ago

@theNailz sorry to hear about this. Luckily I think it's related to a fix I'll be making today—were you on Continue version 0.0.54?

theNailz commented 2 months ago

@theNailz sorry to hear about this. Luckily I think it's related to a fix I'll be making today—were you on Continue version 0.0.54?

Yes 0.0.54

coinzz commented 2 months ago

Same error for me after upgrading from W10 Jetbrains 0.0.56 to 0.0.59. Got fixed by manually copying the correct compiled file as already explained from core\win32-x64\node_sqlite3.node (in case of windows) to build\Release folder.

wenwen12345 commented 2 months ago

I get the same BUG in Webstorm windows11 x64,is anyone know how to fix?

bakermat commented 1 month ago

I'm also encountering this issue, on a brand new Windows 11 ARM64, using VS Code (ARM). Tried the latest release *0.8.46) as well as the latest pre-release, to no avail.

From the debug console: Activating extension 'Continue.continue' failed: \\?\c:\Users\x\.vscode\extensions\continue.continue-0.8.46-win32-arm64\out\build\Release\node_sqlite3.node is not a valid Win32 application. \\?\c:\Users\x\.vscode\extensions\continue.continue-0.8.46-win32-arm64\out\build\Release\node_sqlite3.node.

I tried the suggestions above from https://github.com/continuedev/continue/issues/839#issuecomment-2081875150 and https://github.com/continuedev/continue/issues/839#issuecomment-2215973239 but the error message stays the same, even after disabling / enabling the extension as well as restarting VS Code.

curtfehr commented 1 month ago

Bump, still occurring Windows 11 ARM64 (Snapdragon Elite). After rebuilding sqlite and replacing the node file, got a new error:

mainThreadExtensionService.ts:107 Activating extension 'Continue.continue' failed: vectordb: failed to load native library. You may need to run npm install @lancedb/vectordb-win32-arm64-msvc.

If that does not work, please file a bug report at https://github.com/lancedb/lancedb/issues

Source error: Error: Cannot find module '@lancedb/vectordb-win32-arm64-msvc' Require stack:

  • c:\Users\curt_.vscode\extensions\continue.continue-0.8.49-win32-arm64\out\extension.js
  • c:\Users\curt_\AppData\Local\Programs\Microsoft VS Code\resources\app\out\bootstrap-fork.js.
KrFeher commented 1 month ago

Same problem here with snapdragone Elite. Anyone has a solution?

danielme85 commented 1 month ago

I was also curios about the ARM64 Windows experience so I went and got a hold of one of the new Snapdragon Elite laptops. It's been working out great so far except for this plugin. I just started using a local ollama setup for code completion and this plugin works great for x64 on windows and the ARM M1 apple, not so much for winARM.

I know its probably a small user base right now, but man: the snapdragon elite laptops are awesome: fast, (relatively) cheap vs Apple and all day battery life, so I bet ya it will have more users soon.

Long story short, +1 request for a winARM64 build/fix please!

robvoi commented 1 month ago

+1 here too Would love to use it on my ARM Windows machine.

svantesorberg commented 1 month ago

I managed to run the VSCode extension on my Snapdragon X Elite laptop after building sqlite3 (as described higher up in this thread) and lancedb locally with some tinkering.

I'd be happy to share binaries or walk you through the build process. Though I guess the only sustainable way forward is for the developers of these upstream packages to provide pre-built binaries for windows arm64?

antonovkz commented 1 month ago

I managed to run the VSCode extension on my Snapdragon X Elite laptop after building sqlite3 (as described higher up in this thread) and lancedb locally with some tinkering.

I'd be happy to share binaries or walk you through the build process. Though I guess the only sustainable way forward is for the developers of these upstream packages to provide pre-built binaries for windows arm64?

  • For sqlite3 one way forward could be switching to better-sqlite3 as proposed here.
  • For lancedb I don't imagine it's viable to switch it out for something else, but maybe we can get them to provide binaries for windows arm64. The build was straightforward once I managed to straighten out the build dependencies, at least on an windows arm64 platform, no idea about cross-compiling.

I spent half a day trying to rebuild this damn module on Windows ARM64, but nothing worked. Have you managed to get Continue working on Windows 11 ARM64? Could you share the necessary files?

svantesorberg commented 1 month ago

I managed to run the VSCode extension on my Snapdragon X Elite laptop after building sqlite3 (as described higher up in this thread) and lancedb locally with some tinkering. I'd be happy to share binaries or walk you through the build process. Though I guess the only sustainable way forward is for the developers of these upstream packages to provide pre-built binaries for windows arm64?

  • For sqlite3 one way forward could be switching to better-sqlite3 as proposed here.
  • For lancedb I don't imagine it's viable to switch it out for something else, but maybe we can get them to provide binaries for windows arm64. The build was straightforward once I managed to straighten out the build dependencies, at least on an windows arm64 platform, no idea about cross-compiling.

I spent half a day trying to rebuild this damn module on Windows ARM64, but nothing worked. Have you managed to get Continue working on Windows 11 ARM64? Could you share the necessary files?

Here you go, hope this is permitted. bundles.zip

From the continue folder (e.g. C:\Users\<name>\.vscode\extensions\continue.continue-x.y.z-win32-arm64 ), you need to put node_sqlite3.node under .\out\build\Release\ and the vectordb-win32-arm64-msvc folder under .\out\node_modules\@lancedb\

Keep in mind that I just built this off lancedb master, so no guarantees that it will work for updated versions of continue (or the current one, for that matter).

I'll see if I can cross-compile lancedb for arm64 from my windows x86 machine. If that works I guess there's a chance they could integrate it in their normal builds and provide binaries.

antonovkz commented 1 month ago

I managed to run the VSCode extension on my Snapdragon X Elite laptop after building sqlite3 (as described higher up in this thread) and lancedb locally with some tinkering. I'd be happy to share binaries or walk you through the build process. Though I guess the only sustainable way forward is for the developers of these upstream packages to provide pre-built binaries for windows arm64?

  • For sqlite3 one way forward could be switching to better-sqlite3 as proposed here.
  • For lancedb I don't imagine it's viable to switch it out for something else, but maybe we can get them to provide binaries for windows arm64. The build was straightforward once I managed to straighten out the build dependencies, at least on an windows arm64 platform, no idea about cross-compiling.

I spent half a day trying to rebuild this damn module on Windows ARM64, but nothing worked. Have you managed to get Continue working on Windows 11 ARM64? Could you share the necessary files?

Here you go, hope this is permitted. bundles.zip

From the continue folder (e.g. C:\Users\<name>\.vscode\extensions\continue.continue-x.y.z-win32-arm64 ), you need to put node_sqlite3.node under .\out\build\Release\ and the vectordb-win32-arm64-msvc folder under .\out\node_modules\@lancedb\

Keep in mind that I just built this off lancedb master, so no guarantees that it will work for updated versions of continue (or the current one, for that matter).

I'll see if I can cross-compile lancedb for arm64 from my windows x86 machine. If that works I guess there's a chance they could integrate it in their normal builds and provide binaries.

This worked! You saved me, I was so desperate that I installed the x64 version of VSCode in emulation mode, and of course, that's not ideal. Now I’ve disabled automatic updates and will manually check for new versions from time to time, both to test compatibility with your files and in the hope that the Continue extension developers will provide a fix. Thank you.

ruverav commented 2 weeks ago

@svantesorberg I wanted to try Continue in my ARM64 window laptop and I couldn't. Thank you, it's working fine.

sestinj commented 23 hours ago

Thanks all for providing some workarounds here. I'm going to reach out to LanceDB and SQLite to see if they might be willing to include windows arm64 builds in their releases, but will also take a stab at doing the build myself soon (now that it looks finally available in GH actions! https://github.blog/news-insights/product-news/arm64-on-github-actions-powering-faster-more-efficient-build-systems/)