xmppo / node-expat

libexpat XML SAX parser binding for node.js
https://github.com/xmppo/node-expat
MIT License
385 stars 97 forks source link

Cannot install on Windows 10 #217

Open paulsmithkc opened 2 years ago

paulsmithkc commented 2 years ago

I'm trying to use this package in combination with pkg to build a cross-platform binary.

node-expat seems to work fine in my dev environment (macos) but when running on Window 10, I am having some issues:

When I try to run the app, I see the following error:

Error: C:\Users\<username>\AppData\Local\Temp\pkg\<packageId>\node-expat\build\Release\node_expat.node is not a valid Win32 application.
C:\Users\<username>\AppData\Local\Temp\pkg\<packageId>\node-expat\build\Release\node_expat.node
    at process.dlopen (pkg/prelude/bootstrap.js:2255:28)
←[90m    at Object.Module._extensions..node (node:internal/modules/cjs/loader:1189:18)←[39m
←[90m    at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)←[39m
    at Module.require (pkg/prelude/bootstrap.js:1855:31)
←[90m    at require (node:internal/modules/cjs/helpers:102:18)←[39m
    at bindings (C:\snapshot\cccupload\node_modules\←[4mbindings←[24m\bindings.js:112:48)
    at Object.<anonymous> (C:\snapshot\cccupload\node_modules\←[4mnode-expat←[24m\lib\node-expat.js:4:34)
    at Module._compile (pkg/prelude/bootstrap.js:1930:22) {
  code: ←[32m'ERR_DLOPEN_FAILED'←[39m
paulsmithkc commented 1 year ago

Some investigation showed that it is an issue with node-gyp running in windows.

I was able to get working by manually running node-gyp on the source files after npm install.