parcel-bundler / watcher

👀 A native C++ Node module for querying and subscribing to filesystem events
MIT License
641 stars 40 forks source link

Prebuilt win32 npm package `@parcel/watcher-win32-ia32` not working with electron-builder #181

Open jmeinke opened 1 week ago

jmeinke commented 1 week ago

We are currently using the 32-bit version of Electron for our desktop app, and as a result, we need a build of @parcel/watcher for the win32 architecture. Unfortunately, this build is not available: Uncaught (in promise) Error: Could not dynamically require "@parcel/watcher-win32-ia32".

Our customers have hardcoded the path to the 32-bit installation directory and executable of our desktop application in their third-party applications' configurations. Updating these configurations would require them to uninstall the 32-bit app, reinstall the 64-bit app, and update all of their third-party app configurations accordingly. This is particularly challenging as they often need to update multiple clients (ranging from 4 to 60).

To address this, we plan to modify our desktop app installer to provide both the 32-bit and 64-bit versions of Electron and the necessary native binaries. We will encourage our customers to transition to the 64-bit version as soon as possible, but we recognize that this process will take some time.

In the meantime, it would be extremely helpful if you could provide a prebuilt binary for win32.

jmeinke commented 1 week ago

I've seen that there actually is a prebuilt package: https://www.npmjs.com/package/@parcel/watcher-win32-ia32 However, electron-builder does not seem to install it during the win32 build - in our case it looks like this:

npm run dist:win-development

> abc-desktop-app@5.8.1-dev.4 dist:win-development
> electron-builder --win --config config/development.js

  • electron-builder  version=24.9.4 os=10.0.22631
  • loaded configuration  file=D:\Projects\abc-desktop-app\config\development.js
  • writing effective config  file=dist\builder-effective-config.yaml
  • rebuilding native dependencies  dependencies=keytar@7.9.0, win-verify-signature@1.7.0 platform=win32 arch=ia32
  • install prebuilt binary  name=keytar version=7.9.0 platform=win32 arch=ia32 napi=
  • install prebuilt binary  name=win-verify-signature version=1.7.0 platform=win32 arch=ia32 napi=
• packaging       platform=win32 arch=ia32 electron=30.1.2 appOutDir=dist\win-ia32-unpacked
  • building        target=nsis file=dist\abc-Installer-5.8.1-dev.4.exe archs=ia32 oneClick=false perMachine=false
  • building block map  blockMapFile=dist\abc-Installer-5.8.1-dev.4.exe.blockmap

When looking into the dist\win-ia32-unpacked directory, I see the wrong arch version of @parcel/watcher watcher-win32-x64 there.

If I try to install it manually via npm install @parcel/watcher-win32-ia32 for a local build on my machine, I get the following errors:

npm error code EBADPLATFORM
npm error notsup Unsupported platform for @parcel/watcher-win32-ia32@2.4.2-alpha.0: wanted {"os":"win32","cpu":"ia32"} (current: {"os":"win32","cpu":"x64"})
npm error notsup Valid os:   win32
npm error notsup Actual os:  win32
npm error notsup Valid cpu:  ia32
npm error notsup Actual cpu: x64

We should be able to generate a win32 app build even on a host that uses an actual x64 cpu.

An ugly workaround is to issue the following command in CI before building the installer using electron-installer: npm install @parcel/watcher-win32-ia32 --force