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.47k stars 1.72k forks source link

Failed to create dylib symbolic link on Windows #8149

Open kochizufan opened 3 months ago

kochizufan commented 3 months ago

I tried to make Windows installer of my app with following command and settings:

electron-builder --win --x64 --config ./build_win.js

build_win.js

const config = {
  "appId": "jp.maplat.editor",
  "directories": {
    "output": "dist"
  },
  "files": [
    "assets/win",
    "backend",
    "css",
    "frontend/api",
    "frontend/dist",
    "frontend/fonts",
    "html",
    "img",
    "locales",
    "package.json",
    "package-lock.json",
    "tms_list.json"
  ],
  "win": {
    "icon": "assets/win/icon_win.ico",
    "target": "portable"
  },
  "nsis":{
    "oneClick": false,
    "allowToChangeInstallationDirectory": true
  }
};

module.exports = config;

But it is failed with following errors:

  • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z size=5.6 MB parts=1
  • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z duration=1.104s
  ⨯ cannot execute  cause=exit status 2
                    out=
    7-Zip (a) 21.07 (x64) : Copyright (c) 1999-2021 Igor Pavlov : 2021-12-26

    Scanning the drive for archives:
    1 file, 5635384 bytes (5504 KiB)

    Extracting archive: C:\Users\kochi\AppData\Local\electron-builder\Cache\winCodeSign\618674575.7z
    --
    Path = C:\Users\kochi\AppData\Local\electron-builder\Cache\winCodeSign\618674575.7z
    Type = 7z
    Physical Size = 5635384
    Headers Size = 1492
    Method = LZMA2:24m LZMA:20 BCJ2
    Solid = +
    Blocks = 2

    Sub items Errors: 2

    Archives with Errors: 1

    Sub items Errors: 2

                    errorOut=ERROR: Cannot create symbolic link : �N���C�A���g�͗v�����ꂽ�������ۗL���Ă��܂����B : C:\Users\kochi\AppData\Local\electron-builder\Cache\winCodeS Sign\618674575\darwin\10.12\lib\libcrypto.dylib
    ERROR: Cannot create symbolic link : �N���C�A���g�͗v�����ꂽ�������ۗL���Ă��܂����B : C:\Users\kochi\AppData\Local\electron-builder\Cache\winCodeSign\618674575\darwin\10.1 12\lib\libssl.dylib

                    command='C:\Users\kochi\github\MaplatEditor\node_modules\7zip-bin\win\x64\7za.exe' x -bd 'C:\Users\kochi\AppData\Local\electron-builder\Cache\winCodeSign\618674575.7z' '-oC:\Users\kochi\AppData\Local\electron-builder\Cache\winCodeSign\618674575'
                    workingDir=C:\Users\kochi\AppData\Local\electron-builder\Cache\winCodeSign

Even if I changed the target from NSIS to portable, it was also failed with the same error.

The error says "libssl.dylib" or "Cannot create symbolic link", so I believe it was caused that needless apple resources were extracted in Windows, and failed to create symbolic link on Windows FS. Are there any fix for this or any work-around?

Mayconoliveyra commented 3 months ago

This problem is due to privilege. The solution is simple, just open your project folder in CMD or PowerShell with ADMINISTRATOR privileges.

Ex: image

bfurtonmw commented 3 months ago

This error is happening in our CI where running as administrator is not allowed. Is there a workaround for running as an unprivileged user?

wszgrcy commented 2 months ago

I also encountered this issue and solved it using 'PowerShell with ADMINISTRATOR' But I didn't see any prompts about building Windows on the official website. Is this the correct operation?

bfurtonmw commented 2 months ago

FYI, it seems like it's an issue with the 7zip upgrade under the hood. Workaround: downgrade to electron-builder@24.6.3.

renkei commented 2 months ago

I've the same issue. There is maybe a better workaround available:

Download the winCodeSign.7z package manually. You can use the same URL as electron-builder is using: https://github.com/electron-userland/electron-builder-binaries/releases/download/winCodeSign-2.6.0/winCodeSign-2.6.0.7z

Then extract the archive to the requested location (I've used 7-Zip 23.01 for Windows) so that you have this folder on your machine: C:\Users\<YourUserName>\AppData\Local\electron-builder\Cache\winCodeSign\winCodeSign-2.6.0\

That's it. I got no errors during extraction. Once the folder exists the download and extraction of the 7z file is skipped during the electron-builder run.

Pro:

Con

ianoble commented 2 months ago

I got 2 errors after extraction:

Cannot create symbolic link : A required privilege is not held by the client. : c:\users[username]\appdata\local\electron-builder\cache\wincodesign\wincodesign-2.6.0\darwin\10.12\lib\libcrypto.dylib Cannot create symbolic link : A required privilege is not held by the client. : c:\users[username]\appdata\local\electron-builder\cache\wincodesign\wincodesign-2.6.0\darwin\10.12\lib\libssl.dylib

ehellman commented 1 month ago

We are experiencing this issue as well, downgrading to electron-builder@24.6.3 helped, for now. Hopefully this can be resolved. The downgrade diff does indeed show that the 7zip dependency has also been downgraded, so I wonder if it would help to pin it to the old version using resolutions, if someone actually needs to be on the latest electron-builder until this is resolved.

vijaysharma0757 commented 1 month ago

This problem is due to privilege. The solution is simple, just open your project folder in CMD or PowerShell with ADMINISTRATOR privileges.

Ex: image

Thanks it worked for me. I have tried many ways done its working fine

matsonkepson commented 3 days ago

also solved by running as Admin privileged user, unfortunately workarounds with fixing the 7z version were not helpful for me...