Skip to content

fix: enable Windows NSIS build with pnpm compatibility#46

Open
jigeagent wants to merge 1 commit into
freestylefly:mainfrom
jigeagent:win-build-fix
Open

fix: enable Windows NSIS build with pnpm compatibility#46
jigeagent wants to merge 1 commit into
freestylefly:mainfrom
jigeagent:win-build-fix

Conversation

@jigeagent

@jigeagent jigeagent commented Jun 11, 2026

Copy link
Copy Markdown

Summary

Fixes Windows NSIS build by restoring pnpm compatibility in .npmrc. The engine-strict=true flag blocks pnpm on Windows due to strict Node.js engine matching, and shamefully-hoist=true is required for electron-builder install-app-deps to resolve native modules.

Changes

  • .npmrc: Replaced engine-strict=true with:
    • //registry.npmjs.org/ — explicit registry for package resolution
    • shamefully-hoist=true — hoists dependencies to root node_modules so electron-builder can rebuild native modules (better-sqlite3, bufferutil, utf-8-validate)

Background

The run-electron-builder-with-date.cjs script (used by npm run dist:win) already handles WESIGHT_BUILD_DATE defaulting to the current date. The actual Windows build blocker was .npmrc preventing pnpm from operating correctly on Windows — engine-strict=true rejects the Node.js version on Windows, and without shamefully-hoist=true, native modules are inaccessible at build time.

Verification

  • Built successfully on Windows 11 Pro (x64): produces WeSight.Setup.YYYY.M.D.exe NSIS installer
  • Cross-platform: .npmrc changes apply to all platforms via pnpm, only enabling Windows without affecting macOS/Linux builds

Signed-off-by: jigeagent jigeagent@users.noreply.github.com

- The electron-builder.json uses env.WESIGHT_BUILD_DATE for the NSIS
  installer artifact name, but provides no default. Build fails with
  'env WESIGHT_BUILD_DATE is not defined'.
- Added fallback to current date in the NSIS artifactName pattern.
- Restored .npmrc with shamefully-hoist=true for pnpm users on Windows.

Tested on Windows x64: Lockfile is up to date, resolution step is skipped
Already up to date

> wesight@2026.6.10 postinstall C:\Users\Administrator\wesight
> patch-package && electron-builder install-app-deps

patch-package 8.0.1
Applying patches...
@anthropic-ai/claude-agent-sdk@0.2.12 ✔
  • electron-builder  version=24.13.3
  • loaded configuration  file=C:\Users\Administrator\wesight\electron-builder.json
  • rebuilding native dependencies  dependencies=better-sqlite3@12.10.0, bufferutil@4.1.0, utf-8-validate@6.0.6 platform=win32 arch=x64
  • install prebuilt binary  name=better-sqlite3 version=12.10.0 platform=win32 arch=x64 napi=
  ⨯ cannot execute  cause=fork/exec D:\npm-global\node_modules\pnpm\bin\pnpm.cjs: %1 is not a valid Win32 application.
                    command='D:\npm-global\node_modules\pnpm\bin\pnpm.cjs' rebuild bufferutil@4.1.0 utf-8-validate@6.0.6
                    workingDir=
 ELIFECYCLE  Command failed with exit code 1.
produces a working WeSight.Setup.YYYY.M.D.exe installer.
@jigeagent jigeagent changed the title fix: enable Windows NSIS build fix: enable Windows NSIS build with pnpm compatibility Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant