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

makensis.exe fails with yarn 3 when using pnp #6639

Closed
marchaos opened this issue Feb 15, 2022 · 4 comments
Closed

makensis.exe fails with yarn 3 when using pnp #6639

marchaos opened this issue Feb 15, 2022 · 4 comments
Labels

Comments

@marchaos
Copy link

  • Election Builder Version: 22.14.13
  • Node Version: 16
  • Electron Version: 16.0.7
  • Electron Type (current, beta, nightly)
  • Target: NSIS

I'm using yarn 3.1.1, but imagine this might affect yarn 2 - seems more of an issue with pnp.

  • spawning        command=C:\Users\<user>\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\Bin\makensis.exe -WX -DAPP_ID=RhinoBucket -DAPP_GUID=a6cf6831-9faf-5cd2-abfa-a08114db3e2f -DUNINSTALL_APP_KEY=a6cf6831-9faf-5cd2-abfa-a08114db3e2f -DPRODUCT_NAME=RhinoBucket -DPRODUCT_FILENAME=RhinoBucket -DAPP_FILENAME=RhinoBucket -DAPP_DESCRIPTION= -DVERSION=1.0.0 -DPROJECT_DIR=C:\Users\<user>\dev\<project>\packages\electron-app -DBUILD_RESOURCES_DIR=C:\Users\<user>\dev\<project>\packages\electron-app\build -DAPP_PACKAGE_NAME=RhinoBucket -DMUI_ICON=C:\Users\<user>\dev\<project>\dist\electron\.icon-ico\icon.ico -DMUI_UNICON=C:\Users\<user>\dev\<project>\dist\electron\.icon-ico\icon.ico -DAPP_64=C:\Users\<user>\dev\<project>\dist\electron\RhinoBucket-1.0.0-x64.nsis.7z -DAPP_64_NAME=RhinoBucket-1.0.0-x64.nsis.7z -DAPP_64_HASH=8FA7811188AC802645498FDA783F14EC3F842EF6FFE444CECFEAC09582728C7C73F73BCEE77109F98A203EA9CC81F24885908BF65E749969159FBBAC72492CB2 -DCOMPANY_NAME= -DAPP_INSTALLER_STORE_FILE=rhinobucket-updater\installer.exe -DCOMPRESSION_METHOD=7z -DMULTIUSER_INSTALLMODE_ALLOW_ELEVATION -DINSTALL_MODE_PER_ALL_USERS_REQUIRED -DallowToChangeInstallationDirectory -DSHORTCUT_NAME=RhinoBucket -DUNINSTALL_DISPLAY_NAME=RhinoBucket 1.0.0 -DMUI_WELCOMEFINISHPAGE_BITMAP=${NSISDIR}\Contrib\Graphics\Wizard\nsis3-metro.bmp -DMUI_UNWELCOMEFINISHPAGE_BITMAP=${NSISDIR}\Contrib\Graphics\Wizard\nsis3-metro.bmp -DESTIMATED_SIZE=189571 -DCOMPRESS=auto -DUNINSTALLER_OUT_FILE -XOutFile "C:\Users\<user>\dev\<project>\dist\electron\RhinoBucket Setup 1.0.0.exe" -XVIProductVersion 1.0.0.0 -XVIAddVersionKey 
/LANG=1033 ProductName "RhinoBucket" -XVIAddVersionKey /LANG=1033 ProductVersion "1.0.0" -XVIAddVersionKey /LANG=1033 LegalCopyright "Copyright © 2022 " -XVIAddVersionKey /LANG=1033 FileDescription "" -XVIAddVersionKey /LANG=1033 FileVersion "1.0.0" -XVIAddVersionKey /LANG=1033 CompanyName "" -XUnicode true -XSetCompressor zlib - cwd=C:\Users\<user>\dev\<project>\.yarn\cache\app-builder-lib-npm-22.14.13-a7f366c579-a32a5ef25b.zip\node_modules\app-builder-lib\templates\nsis
  • exited          command=makensis.exe code=-4058 pid=undefined
  • async task error  error=spawn C:\Users\<user>\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\Bin\makensis.exe ENOENT
  ⨯ spawn C:\Users\<user>\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\Bin\makensis.exe ENOENT  failedTask=build stackTrace=Error: spawn C:\Users\<user>\AppData\Local\electron-builder\Cache\nsis\nsis-3.0.4.1\Bin\makensis.exe ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
    at onErrorNT (node:internal/child_process:477:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

The ENOENT seems to be caused by the cwd location. cwd=C:\Users\<user>\dev\<project>\.yarn\cache\app-builder-lib-npm-22.14.13-a7f366c579-a32a5ef25b.zip\node_modules\app-builder-lib\templates\nsis is a zip file location / yarn dep which probably needs specific logic to handle. I patch NsisTarget.js so that cwd was a local directory, and copied the templates into there from app-builder-lib\templates and now it works.

Not sure if I'm missing some option to allow yarn deps to be resolved, but from looking at how nsisTemplatesDir - nothing special seems to be happening.

@github-actions github-actions bot added the nsis label Feb 15, 2022
@mmaietta
Copy link
Collaborator

It fails for all pnpm unfortunately. I was able to dig into where it's failing but it's unfortunately, not electron-builder code:
#6289 (comment)

I'd love to have pnpm support, but I don't understand how it parses the dependency tree for packaging for electron nor how to write Go.

@mmaietta
Copy link
Collaborator

Closing this as a duplicate of #6289

@marchaos
Copy link
Author

This doesn't look like a duplicate on #6289 - I'm not bundling dependencies using yarn (bundle is built separately).

@burgil
Copy link

burgil commented Jun 6, 2022

hOLY Moly I was just able to figure it out and it worked! (I can finally build an installer using electron-builder using yarn3)
@marchaos
We simply need to unplug it on yarn 3, but not just it (referring to electron-builder) we need to specifically unplug app-builder-lib, But you may say, I did that, It didn't work

I just found out all we had to do is add the -R flag to the unplug command

after running yarn unplug --help I got more insights,
check it out if you run this it will work:

yarn unplug app-builder-lib -R

Btw it's in yarn 3 docs, it says some plugins will need to be unplugged to work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants