Skip to content

Yarn 3 module rebuild failing #8024

@davej

Description

@davej
  • Electron-Builder Version: 24.9.1
  • Node Version: 20.1.0
  • Electron Version: 28.2.1
  • Electron Type (current, beta, nightly): current
  • Target: macOS

When moving from Yarn 1 to Yarn 3 there is now an issue when rebuilding a module. This issue was not a problem with Yarn 1. I did some debugging and rebuild seems to be working fine with @electron/rebuild. I can even get it working if I use v24.6.0 of app-builder-lib (when it used @electron/rebuild). But it seems to be broken when using Electron Builder's rebuild functionality.

Here is a repro that you can clone: https://github.com/davej/electron-boilerplate-yarn-3-issue

To recreate simple clone the repo and run yarn.
After install has finished then you should see output that ends like this:

➤ YN0009: │ electron-boilerplate@workspace:. couldn't be built successfully (exit code 1, logs can be found here: /private/var/folders/h1/9dzghzlx0xgcdw3j5yjk0hg00000gn/T/xfs-bc5c23f7/build.log)
➤ YN0000: └ Completed in 5s 484ms
➤ YN0000: Failed with errors in 44s 972ms

If you click into the logs then you will see something like this:

# This file contains the result of Yarn building a package (electron-boilerplate@workspace:.)
# Script name: postinstall

  • electron-builder  version=24.9.1
  • loaded configuration  file=package.json ("build" field)
  • rebuilding native dependencies  dependencies=@bugsnag/plugin-electron-app@7.22.2, @bugsnag/plugin-electron-client-state-persistence@7.22.2 platform=darwin arch=arm64
  • rebuilding native dependency  name=@bugsnag/plugin-electron-client-state-persistence version=7.22.2
  • rebuilding native dependency  name=@bugsnag/plugin-electron-app version=7.22.2
  ⨯ cannot execute  cause=exit status 1
                    out=Usage Error: Couldn't find a script named "install".

$ yarn run [--inspect] [--inspect-brk] [-T,--top-level] [-B,--binaries-only] <scriptName> ...

                    command=/private/var/folders/h1/9dzghzlx0xgcdw3j5yjk0hg00000gn/T/xfs-b1ba03f1/yarn run install
                    workingDir=/Users/davejeffery/code/test/electron-boilerplate-yarn-3-issue/node_modules/@bugsnag/plugin-electron-app

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions