Closed MountainAndMorning closed 1 month ago
What version of Windows? What CPU architecture? Can you double check your default cargo
target (rustup default
)?
It seems like the module isn't targeting Windows.
Thanks for your help. Windows 10 version 21H2 AMD Ryzen Threadripper 3970X 32-Core I solved the problem by deleting the rust installed by the rust-1.70,0-i686-pc-windows-gpu installer and reinstall the rust by the rustup-init installer.
Running into the same error. I am able to build and run another rust executable successfully.
Error: \\?\C:\Users\korolev\cpu-count\index.node is not a valid Win32 application.
\\?\C:\Users\korolev\cpu-count\index.node
at Module._extensions..node (node:internal/modules/cjs/loader:1340:18)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Module.require (node:internal/modules/cjs/loader:1143:19)
at require (node:internal/modules/cjs/helpers:110:18) {
code: 'ERR_DLOPEN_FAILED'
}
rustup show
returns
PS C:\Users\korolev\cpu-count> rustup show
Default host: aarch64-pc-windows-msvc
rustup home: C:\Users\korolev\.rustup
stable-aarch64-pc-windows-msvc (default)
rustc 1.80.1 (3f5fd8dd4 2024-08-06)
Running Windows 11 Pro on Parallels (Apple Silicon 3.20 GHz (6 processors)) with Node v18.16.1 x64
edit: switching rustup default toolchain to stable-x86_64-pc-windows-msvc
seems to fix the issue
@jdms754 That seems sounds like x86 Windows is being run and not ARM. This would be expected.
FYI, Neon does not do any special building. A Node native addon is a standard C-dynamic library (cdylib
in Rust). Node loads the shared library with dlopen
like the OS would for any other shared library and looks for a symbol (function) with the name napi_register_module_v1
. That's what #[neon::main]
generates.
I'm going to close this issue since it's highly likely any similar issues are related to misconfigured Rust toolchain and not Neon.
I followed the hello world example on Windows 10. node -v v18.16.0 npm -v 9.5.1
But got the error below:
(base) C:\Users\iridium\Documents\cpu-count>node Welcome to Node.js v18.16.0. Type ".help" for more information.
I also try use the node-v14.16.0-x64 and the node-v16.13.0-x64 and also failed.