leafac / caxa

📦 Package Node.js applications into executable binaries 📦
https://npm.im/caxa
697 stars 33 forks source link

Windows exe error .node dependencies #76

Closed jowparks closed 1 year ago

jowparks commented 1 year ago

I am using caxa 3.0.1 to build binaries for windows/mac/linux. Works great for the most part, bravo for such a simple and elegant tool.

I am running into an issue with the windows build though, I have multiple .node dependencies. The executable runs fine until one of the .node files is being accessed, seems like a file path error.

PS C:\Users\jowpa\Downloads\windows-x86_64> .\ironfish.exe wallet:create
    Error: The specified module could not be found.
    \\?\C:\Users\jowpa\AppData\Local\Temp\caxa\applications\ironfish\qsneqbbzgv\0\n
    ode_modules\@ironfish\rust-nodejs-win32-x64-msvc\ironfish-rust-nodejs.win32-x64
    -msvc.node
    Code: ERR_DLOPEN_FAILED

The file does exist:

PS C:\Users\jowpa\Downloads\windows-x86_64> ls C:\Users\jowpa\AppData\Local\Temp\caxa\applications\ironfish\qsneqbbzgv\0\node_modules\@ironfish\rust-nodejs-win32-x64-msvc\ironfish-rust-nodejs.win32-x64-msvc.node

    Directory: C:\Users\jowpa\AppData\Local\Temp\caxa\applications\ironfish\qsneqbbz
    gv\0\node_modules\@ironfish\rust-nodejs-win32-x64-msvc

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----         3/31/2023   8:57 AM       94656000 ironfish-rust-nodejs.win32-x64-msvc.node

Seems like the error is coming from the prefixed: \\?\ I am using the command to generate:

npx caxa --input . --output ironfish.exe -- "{{caxa}}/node_modules/.bin/node" "--enable-source-maps" "{{caxa}}/node_modules/ironfish/bin/run"
jowparks commented 1 year ago

This actually seemed to be an issue with not having C++ redistributable installed, I installed here: https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist?view=msvc-170 And

Note that the \\?\ is extended file path syntax for windows, so that wasn't actually causing the issue (red herring). I found the solution by: https://stackoverflow.com/questions/41253450/error-the-specified-module-could-not-be-found