continue icon indicating copy to clipboard operation
continue copied to clipboard

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

Open ktos opened this issue 1 year ago • 19 comments

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

ktos avatar Feb 09 '24 22:02 ktos

How can I solve the same problem I encountered?

DanielYzd avatar Mar 27 '24 09:03 DanielYzd

the same problem +1

q479902964 avatar Apr 24 '24 09:04 q479902964

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

permpkin avatar Apr 29 '24 04:04 permpkin

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

dschonholtz avatar Jul 09 '24 01:07 dschonholtz

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.

theNailz avatar Jul 15 '24 06:07 theNailz

@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?

sestinj avatar Jul 15 '24 15:07 sestinj

@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

theNailz avatar Jul 24 '24 11:07 theNailz

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.

coinzz avatar Aug 09 '24 12:08 coinzz

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

wenwen12345 avatar Aug 12 '24 13:08 wenwen12345