Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnpm build fail, windows 目录文件路径过长导致构建错误 #574

Closed
4 tasks done
NHZEX opened this issue Jul 28, 2024 · 4 comments
Closed
4 tasks done

pnpm build fail, windows 目录文件路径过长导致构建错误 #574

NHZEX opened this issue Jul 28, 2024 · 4 comments

Comments

@NHZEX
Copy link

NHZEX commented Jul 28, 2024

Describe the bug

构建错误

  • electron-builder  version=24.13.3 os=10.0.22631
  • loaded configuration  file=F:\_REMOVE_\test123000000000000001\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=31.3.0 appOutDir=dist\win-unpacked
  • building        target=nsis file=dist\dev-client-1.0.0-setup.exe archs=x64 oneClick=true perMachine=false
  ⨯ C:\Users\_REMOVE_\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.electron.app"
Command line defined: "APP_GUID=_REMOVE_"
Command line defined: "UNINSTALL_APP_KEY=_REMOVE_"
Command line defined: "PRODUCT_NAME=dev-client"
Command line defined: "PRODUCT_FILENAME=dev-client"
Command line defined: "APP_FILENAME=dev-client"
Command line defined: "APP_DESCRIPTION=An Electron application with Vue and TypeScript"
Command line defined: "VERSION=1.0.0"
Command line defined: "PROJECT_DIR=F:\_REMOVE_\test123000000000000001"
Command line defined: "BUILD_RESOURCES_DIR=F:\_REMOVE_\test123000000000000001\build"
Command line defined: "APP_PACKAGE_NAME=dev-client"
Command line defined: "MUI_ICON=F:\_REMOVE_\test123000000000000001\build\icon.ico"
Command line defined: "MUI_UNICON=F:\_REMOVE_\test123000000000000001\build\icon.ico"
Command line defined: "APP_64=F:\_REMOVE_\test123000000000000001\dist\dev-client-1.0.0-x64.nsis.7z"
Command line defined: "APP_64_NAME=dev-client-1.0.0-x64.nsis.7z"
Command line defined: "APP_64_HASH=_REMOVE_"
Command line defined: "APP_64_UNPACKED_SIZE=300029"
Command line defined: "COMPANY_NAME=example.com"
Command line defined: "APP_INSTALLER_STORE_FILE=dev-client-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=dev-client"
Command line defined: "UNINSTALL_DISPLAY_NAME=dev-client"
Command line defined: "RECREATE_DESKTOP_SHORTCUT"
Command line defined: "ESTIMATED_SIZE=300028"
Command line defined: "COMPRESS=auto"
Command line defined: "BUILD_UNINSTALLER"
Command line defined: "UNINSTALLER_OUT_FILE=F:\_REMOVE_\test123000000000000001\dist\__uninstaller-nsis-dev-client.exe"
Processing config: C:\Users\_REMOVE_\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\nsisconf.nsh
Processing script file: "<stdin>" (UTF8)

Error output:
!include: could not open file: "F:\_REMOVE_\test123000000000000001\node_modules\.pnpm\[email protected][email protected][email protected]__electr_jhkj5etvr5lkpiqd5wtx2uh6ge\node_modules\app-builder-lib\templates\nsis\include\allowOnlyOneInstallerInstance.nsh"
Error in script "<stdin>" on line 87 -- aborting creation process
  failedTask=build stackTrace=Error: C:\Users\_REMOVE_\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.electron.app"
Command line defined: "APP_GUID=_REMOVE_"
Command line defined: "UNINSTALL_APP_KEY=_REMOVE_"
Command line defined: "PRODUCT_NAME=dev-client"
Command line defined: "PRODUCT_FILENAME=dev-client"
Command line defined: "APP_FILENAME=dev-client"
Command line defined: "APP_DESCRIPTION=An Electron application with Vue and TypeScript"
Command line defined: "VERSION=1.0.0"
Command line defined: "PROJECT_DIR=F:\_REMOVE_\test123000000000000001"
Command line defined: "BUILD_RESOURCES_DIR=F:\_REMOVE_\test123000000000000001\build"
Command line defined: "APP_PACKAGE_NAME=dev-client"
Command line defined: "MUI_ICON=F:\_REMOVE_\test123000000000000001\build\icon.ico"
Command line defined: "MUI_UNICON=F:\_REMOVE_\test123000000000000001\build\icon.ico"
Command line defined: "APP_64=F:\_REMOVE_\test123000000000000001\dist\dev-client-1.0.0-x64.nsis.7z"
Command line defined: "APP_64_NAME=dev-client-1.0.0-x64.nsis.7z"
Command line defined: "APP_64_HASH=_REMOVE_"
Command line defined: "APP_64_UNPACKED_SIZE=300029"
Command line defined: "COMPANY_NAME=example.com"
Command line defined: "APP_INSTALLER_STORE_FILE=dev-client-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=dev-client"
Command line defined: "UNINSTALL_DISPLAY_NAME=dev-client"
Command line defined: "RECREATE_DESKTOP_SHORTCUT"
Command line defined: "ESTIMATED_SIZE=300028"
Command line defined: "COMPRESS=auto"
Command line defined: "BUILD_UNINSTALLER"
Command line defined: "UNINSTALLER_OUT_FILE=F:\_REMOVE_\test123000000000000001\dist\__uninstaller-nsis-dev-client.exe"
Processing config: C:\Users\_REMOVE_\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\nsisconf.nsh
Processing script file: "<stdin>" (UTF8)
     Error output:
!include: could not open file: "F:\_REMOVE_\test123000000000000001\node_modules\.pnpm\[email protected][email protected][email protected]__electr_jhkj5etvr5lkpiqd5wtx2uh6ge\node_modules\app-builder-lib\templates\nsis\include\allowOnlyOneInstallerInstance.nsh"
Error in script "<stdin>" on line 87 -- aborting creation process
         at ChildProcess.<anonymous> (F:\_REMOVE_\test123000000000000001\node_modules\.pnpm\[email protected]\node_modules\builder-util\src\util.ts:252:14)
    at Object.onceWrapper (node:events:632:26)
    at ChildProcess.emit (node:events:517:28)
    at ChildProcess.cp.emit (F:\_REMOVE_\test123000000000000001\node_modules\.pnpm\[email protected]\node_modules\cross-spawn\lib\enoent.js:34:29)
    at maybeClose (node:internal/child_process:1098:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:303:5)

解决方案:
.npmrc 目前还需要添加该设置才能解决兼容性。

node-linker=hoisted

pnpm: 9.6.0

资料:
nodejs/node#50753 (comment)

Electron-Vite Version

2.3.0

Electron Version

31.3.0

Vite Version

5.3.1

Validations

@alex8088
Copy link
Owner

脚手架默认已有配置

@NHZEX
Copy link
Author

NHZEX commented Jul 30, 2024

脚手架默认已有配置

我初始化脚手架的配置只有

electron_mirror=https://npmmirror.com/mirrors/electron/
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/
shamefully-hoist=true

补上这个才成功的

node-linker=hoisted

@zephyr-peak
Copy link

脚手架默认配置

我初始化脚手架的配置只有

electron_mirror=https://npmmirror.com/mirrors/electron/
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/
shamefully-hoist=true

补上这个才成功的

node-linker=hoisted

大佬请问下我补上这个还是同样的问题还请您指导一下
node:18.0.2
pnpm:9.0.6

@NHZEX
Copy link
Author

NHZEX commented Dec 26, 2024

大佬请问下我补上这个还是同样的问题还请您指导一下 node:18.0.2 pnpm:9.0.6

我的npmrc配置,环境 node: 20.17.0; electron: 31.7.3; pnpm: 9.x

electron_mirror=https://npmmirror.com/mirrors/electron/
electron_builder_binaries_mirror=https://npmmirror.com/mirrors/electron-builder-binaries/
shamefully-hoist=true
node-linker=hoisted

建议把完整错误找出来贴一下。

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

No branches or pull requests

3 participants