Use npm install --legacy-peer-deps (#326)

Fixes #309 

Unfortunately a lot of React.js apps have this problem with peer deps
because older dependencies specify pre-v19. Because Dyad app templates
do (and should) explicitly specify React as a dependnecy, using
`--legacy-peer-deps` gives us the right behavior where it effectively
does not install peer deps and avoids the React version errors.

For pnpm, we have an explicit lockfiles for our templates so there isn't
an issue.

Context:
https://stackoverflow.com/questions/66239691/what-does-npm-install-legacy-peer-deps-do-exactly-when-is-it-recommended-wh

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
This commit is contained in:
Will Chen
2025-06-03 22:26:39 -07:00
committed by GitHub
parent a70d16dfac
commit e060f780b9
2 changed files with 2 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ async function executeAppLocalNode({
event: Electron.IpcMainInvokeEvent;
}): Promise<void> {
const process = spawn(
"(pnpm install && pnpm run dev --port 32100) || (npm install && npm run dev -- --port 32100)",
"(pnpm install && pnpm run dev --port 32100) || (npm install --legacy-peer-deps && npm run dev -- --port 32100)",
[],
{
cwd: appPath,