electron / electron/forge

Yarn local workspaces no longer working - fails on Preparing native dependencies

Open
#3,597 3 comments 2 reactions 0 assignees View on GitHub
bug package workspaces
Dominant language
TypeScript
Stars
7.1k
Forks
641
Avg merge
3d 1h
Merged PRs (30d)
30

Description

### Pre-flight checklist

- [X] I have read the [contribution documentation](https://github.com/electron/forge/blob/main/CONTRIBUTING.md) for this project.
- [X] I agree to follow the [code of conduct](https://github.com/electron/electron/blob/main/CODE_OF_CONDUCT.md) that this project uses.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.

### Electron Forge version

7.4.0

### Electron version

30.0.3

### Operating system

Windows 10

### Last known working Electron Forge version

7.2.0

### Expected behavior

I had an issue #3388 about using yarn workspaces for a monorepo where the my electron app depends on other local workspace packages. At the time 7.2.0 was out and @easternmotors was able to show me how to configure yarn to get it to build using the `workspaces:` protocol.

Upgrading that test repo to 7.4.0, it now crashes on the "Preparing native dependencies" step.
![image](https://github.com/electron/forge/assets/6005836/3e825543-c72b-4af0-bd51-2306af5fe2f5)

I'm new to yarn but it doesn't appear to output any error on the crash. Running `make` with npm instead crashes on the same step and provides an unhelp generic error:

```
npm ERR! Lifecycle script `make` failed with error:
npm ERR! Error: command failed
npm ERR! in workspace: electron-app@1.0.0
npm ERR! at location: C:\Users\joeja\projects\yarn-electron-workspaces\packages\electron-app
```

This test repo is just an electron app created with the command `yarn create electron-app electron-app --template vite` and a local workspace test package added to its dependencies, so very easy to repeat.

### Actual behavior

It should build when a local workspace is used as a dependency

### Steps to reproduce

I have two repo to simulate it was working on 7.2 and failing on 7.4:

### 7.4.0 Fail Test Repo
1. Clone test repo using electron-forge 7.4.0:
https://github.com/joezappie/yarn-electron-workspaces/tree/bug/electron-forge-make
2. Run `yarn workspace electron-app make'
3. See that it crashes on the `Preparing native dependencies` step

### 7.2.0 Success Test Repo
1. Clone test repo using electron-forge 7.2.0:
https://github.com/joezappie/yarn-electron-workspaces
2. Run `yarn workspace electron-app make'
3. See that it successfully builds

### Additional information

I tried 7.3.0/7.3.1 but I run into an an error saying `electron-forge/plugin-vite` needed to be in my dev dependencies, despite being in it so I gave up on those versions. Not sure if its 7.3 or 7.4 that broke the module resolution of local workspaces dependencies.

Is there now a different way of needing to do this?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.