electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.73k stars 1.74k forks source link

ERR_ELECTRON_BUILDER_CANNOT_EXECUTE: "could not open file: ....nsis\include\allowOnlyOneInstallerInstance.nsh" #8346

Open Ortieez opened 4 months ago

Ortieez commented 4 months ago

Hi, I have an issue when I'm trying to build this electron-vite app to windows it throws an error:

Error output ```bash • electron-builder version=24.13.3 os=10.0.22631 • loaded configuration file=C:\Users\alipe\Documents\My Projects\dnd-app\electron-builder.yml • writing effective config file=dist\builder-effective-config.yaml • skipped dependencies rebuild reason=npmRebuild is set to false • packaging platform=win32 arch=x64 electron=28.3.3 appOutDir=dist\win-unpacked • building target=nsis file=dist\sqlite-demo-0.0.1-setup.exe archs=x64 oneClick=true perMachine=false ⨯ C:\Users\alipe\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\Bin\makensis.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE Exit code: 1 Output: Command line defined: "APP_ID=com.dnd-app" Command line defined: "APP_GUID=9bf2585d-ff7c-5c41-b388-ebed16c33dff" Command line defined: "UNINSTALL_APP_KEY=9bf2585d-ff7c-5c41-b388-ebed16c33dff" Command line defined: "PRODUCT_NAME=dnd-app" Command line defined: "PRODUCT_FILENAME=dnd-app" Command line defined: "APP_FILENAME=sqlite-demo" Command line defined: "APP_DESCRIPTION=An Electron application with React and TypeScript" Command line defined: "VERSION=0.0.1" Command line defined: "PROJECT_DIR=C:\Users\alipe\Documents\My Projects\dnd-app" Command line defined: "BUILD_RESOURCES_DIR=C:\Users\alipe\Documents\My Projects\dnd-app\build" Command line defined: "APP_PACKAGE_NAME=sqlite-demo" Command line defined: "MUI_ICON=C:\Users\alipe\Documents\My Projects\dnd-app\build\icon.ico" Command line defined: "MUI_UNICON=C:\Users\alipe\Documents\My Projects\dnd-app\build\icon.ico" Command line defined: "APP_64=C:\Users\alipe\Documents\My Projects\dnd-app\dist\sqlite-demo-0.0.1-x64.nsis.7z" Command line defined: "APP_64_NAME=sqlite-demo-0.0.1-x64.nsis.7z" Command line defined: "APP_64_HASH=ED2BCF96CE16086CBB658F4DBCC91A4EBBA8092DDA53EA6F10B44A2E2AB64590A296B40F19C64DC68D703997AE04AE344FD8032776A369BEA2E8D2C1A64C7E03" Command line defined: "APP_64_UNPACKED_SIZE=274786" Command line defined: "COMPANY_NAME=example.com" Command line defined: "APP_PRODUCT_FILENAME=dnd-app" Command line defined: "APP_INSTALLER_STORE_FILE=sqlite-demo-updater\installer.exe" Command line defined: "COMPRESSION_METHOD=7z" Command line defined: "ONE_CLICK" Command line defined: "RUN_AFTER_FINISH" Command line defined: "SHORTCUT_NAME=dnd-app" Command line defined: "UNINSTALL_DISPLAY_NAME=dnd-app" Command line defined: "RECREATE_DESKTOP_SHORTCUT" Command line defined: "ESTIMATED_SIZE=274785" Command line defined: "COMPRESS=auto" Command line defined: "BUILD_UNINSTALLER" Command line defined: "UNINSTALLER_OUT_FILE=C:\Users\alipe\Documents\My Projects\dnd-app\dist\__uninstaller-nsis-sqlite-demo.exe" Processing config: C:\Users\alipe\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\nsisconf.nsh Processing script file: "" (UTF8) Error output: !include: could not open file: "C:\Users\alipe\Documents\My Projects\dnd-app\node_modules\.pnpm\app-builder-lib@24.13.3_dmg-builder@24.13.3_electron-builder-squirrel-windows@24.13.3__electr_jhkj5etvr5lkpiqd5wtx2uh6ge\node_modules\app-builder-lib\templates\nsis\include\allowOnlyOneInstallerInstance.nsh" Error in script "" on line 87 -- aborting creation process failedTask=build stackTrace=Error: C:\Users\alipe\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\Bin\makensis.exe process failed ERR_ELECTRON_BUILDER_CANNOT_EXECUTE Exit code: 1 Output: Command line defined: "APP_ID=com.dnd-app" Command line defined: "APP_GUID=9bf2585d-ff7c-5c41-b388-ebed16c33dff" Command line defined: "UNINSTALL_APP_KEY=9bf2585d-ff7c-5c41-b388-ebed16c33dff" Command line defined: "PRODUCT_NAME=dnd-app" Command line defined: "PRODUCT_FILENAME=dnd-app" Command line defined: "APP_FILENAME=sqlite-demo" Command line defined: "APP_DESCRIPTION=An Electron application with React and TypeScript" Command line defined: "VERSION=0.0.1" Command line defined: "PROJECT_DIR=C:\Users\alipe\Documents\My Projects\dnd-app" Command line defined: "BUILD_RESOURCES_DIR=C:\Users\alipe\Documents\My Projects\dnd-app\build" Command line defined: "APP_PACKAGE_NAME=sqlite-demo" Command line defined: "MUI_ICON=C:\Users\alipe\Documents\My Projects\dnd-app\build\icon.ico" Command line defined: "MUI_UNICON=C:\Users\alipe\Documents\My Projects\dnd-app\build\icon.ico" Command line defined: "APP_64=C:\Users\alipe\Documents\My Projects\dnd-app\dist\sqlite-demo-0.0.1-x64.nsis.7z" Command line defined: "APP_64_NAME=sqlite-demo-0.0.1-x64.nsis.7z" Command line defined: "APP_64_HASH=ED2BCF96CE16086CBB658F4DBCC91A4EBBA8092DDA53EA6F10B44A2E2AB64590A296B40F19C64DC68D703997AE04AE344FD8032776A369BEA2E8D2C1A64C7E03" Command line defined: "APP_64_UNPACKED_SIZE=274786" Command line defined: "COMPANY_NAME=example.com" Command line defined: "APP_PRODUCT_FILENAME=dnd-app" Command line defined: "APP_INSTALLER_STORE_FILE=sqlite-demo-updater\installer.exe" Command line defined: "COMPRESSION_METHOD=7z" Command line defined: "ONE_CLICK" Command line defined: "RUN_AFTER_FINISH" Command line defined: "SHORTCUT_NAME=dnd-app" Command line defined: "UNINSTALL_DISPLAY_NAME=dnd-app" Command line defined: "RECREATE_DESKTOP_SHORTCUT" Command line defined: "ESTIMATED_SIZE=274785" Command line defined: "COMPRESS=auto" Command line defined: "BUILD_UNINSTALLER" Command line defined: "UNINSTALLER_OUT_FILE=C:\Users\alipe\Documents\My Projects\dnd-app\dist\__uninstaller-nsis-sqlite-demo.exe" Processing config: C:\Users\alipe\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\nsisconf.nsh Processing script file: "" (UTF8) Error output: !include: could not open file: "C:\Users\alipe\Documents\My Projects\dnd-app\node_modules\.pnpm\app-builder-lib@24.13.3_dmg-builder@24.13.3_electron-builder-squirrel-windows@24.13.3__electr_jhkj5etvr5lkpiqd5wtx2uh6ge\node_modules\app-builder-lib\templates\nsis\include\allowOnlyOneInstallerInstance.nsh" Error in script "" on line 87 -- aborting creation process at ChildProcess. (C:\Users\alipe\Documents\My Projects\dnd-app\node_modules\.pnpm\builder-util@24.13.1\node_modules\builder-util\src\util.ts:252:14) at Object.onceWrapper (node:events:634:26) at ChildProcess.emit (node:events:519:28) at ChildProcess.cp.emit (C:\Users\alipe\Documents\My Projects\dnd-app\node_modules\.pnpm\cross-spawn@7.0.3\node_modules\cross-spawn\lib\enoent.js:34:29) at maybeClose (node:internal/child_process:1105:16) at Process.ChildProcess._handle.onexit (node:internal/child_process:305:5)  ELIFECYCLE  Command failed with exit code 1. ```

If needed, my repo for this project is: github.com/ortieez/dnd-app

I have no clue what to do with this.

mmaietta commented 4 months ago

Are you using pnpm? If so, can you try these settings for your .npmrc? https://pnpm.io/next/npmrc#virtual-store-dir https://pnpm.io/next/npmrc#virtual-store-dir-max-length (set it something lower than default, like 80?)

Ortieez commented 4 months ago

Thanks for the tip, however that still does not work. I have tried setting the virtual-store-dir, then tried setting the number to 80, 70, 60, 50.. But nothing worked. I also tried with npm.


HOWEVER I now tried using yarn instead, it somehow worked and the app built successfully.

I am really confused.. but it works with yarn :D

gzdunek commented 4 months ago

I just encountered the same problem with pnpm and setting virtual-store-dir-max-length=70 helped.

hsnfirdaus commented 4 months ago

Can confirm, setting virtual-store-dir-max-length=70 then reinstall using pnpm install fix the issue.

Guocccw commented 4 months ago

先改virtual-store-dir-max-length=70再pnpm install 直接 ok

embraceyouting commented 4 months ago

Finally good, really can't stand it

SalimOfShadow commented 3 months ago

Running pnpm config set virtual-store-dir-max-length 70 worked just fine! Can someone please help me understand why?