electron-builder icon indicating copy to clipboard operation
electron-builder copied to clipboard

pnpm monorepo build error

Open gjfei opened this issue 2 years ago • 8 comments

  • Electron-Builder Version: 23.0.3
  • Node Version: 16.13.2
  • Electron Version: 19.0.4
  • Electron Type (current, beta, nightly):
  • Target: window

image

reproduction

gjfei avatar Jun 10 '22 06:06 gjfei

help me

gjfei avatar Jun 10 '22 06:06 gjfei

Are we sure that is an issue with electron-builder? It seems to be saying your pnpm installation is not a valid win32 application. Can you try node 14 or a newer version of node 16?

mmaietta avatar Jul 04 '22 04:07 mmaietta

This is the same issue as this https://github.com/electron-userland/electron-builder/issues/6289

Which is because of this issue that's been fixed in app-builder https://github.com/develar/app-builder/issues/63

But hasn't been pulled in because:

https://github.com/develar/app-builder/issues/83 https://github.com/electron-userland/electron-builder/pull/6684

hipstersmoothie avatar Jul 27 '22 22:07 hipstersmoothie

Does this workaround work correctly for monorepos? https://www.electron.build/#note-for-pnpm

mmaietta avatar Jul 28 '22 16:07 mmaietta

Checking on that now. But using any of those options kills most of the usefulness of pnpm. Proper support would be a huge improvement. Is there an issue tracking that?

hipstersmoothie avatar Jul 28 '22 17:07 hipstersmoothie

https://github.com/electron-userland/electron-builder/issues/6933#issuecomment-1197434288 We're blocked from updating by https://github.com/develar/app-builder/issues/83

mmaietta avatar Jul 28 '22 18:07 mmaietta

I was running into a similar issue (reported as #7029), but with yarn, and had a similar root cause where the .yarn/releases/yarn-*.cjs file we had checked into our repo had a #!/usr/bin/env node shebang. I found that on changing the shebang to be just #!node, I was able to fix my build issues.

Perhaps possible to do a similar hack to pnpm/bin/pnpm.cjs file as an immediate workaround, though ideally could update app-builder and have that be fixed there.

MasterOdin avatar Aug 12 '22 19:08 MasterOdin

Having the same problem, the workaround is calling pnpm electron-builder instead of a package script.


~~I could make it work without the node-linker=hoisted (which is is the whole point of using pnpm) option, my .npmrc currently is:~~

strict-peer-dependencies=false
shamefully-hoist=true

I run the build process for the renderer, and then pnpm electron-builder -- calling it in script throws not a valid win32 application.

I also had to move electron-* packages (electron-updater, etc.) to deps instead of devDeps.


Edit:

Tested in another env and it's actually not working without node-linker=hoisted. Maybe I had some leftover files in node_modules.

rafaberaldo avatar Aug 22 '22 14:08 rafaberaldo

Still have this problem, I have to use npm build it.

kooriookami avatar Nov 23 '22 06:11 kooriookami

Why is this issue still present? The bugfix on app-builder should be deployed already

ramiel avatar Sep 22 '23 14:09 ramiel

@ramiel because the dependency update is still broken See: https://github.com/electron-userland/electron-builder/pull/7774

And comment requesting help from @develar to resolve the issue in app-builder https://github.com/develar/app-builder/issues/83#issuecomment-1716257591

mmaietta avatar Sep 22 '23 17:09 mmaietta