Skip to content

Commit

Permalink
fix(cli): add --legacy-peer-deps for npm users (#2823 by @frankcalise)
Browse files Browse the repository at this point in the history
  • Loading branch information
frankcalise authored Oct 29, 2024
1 parent f82f324 commit e59d880
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/commands/new.ts
Original file line number Diff line number Diff line change
Expand Up @@ -748,9 +748,11 @@ module.exports = {
startSpinner(unboxingMessage)

// do base install
await packager.install({ ...packagerOptions, onProgress: log })
const installCmd = packager.installCmd({ packagerName })
await system.run(installCmd, { onProgress: log })
// now that expo is installed, we can run their install --fix for best Expo SDK compatibility
await system.run("npx expo install --fix", { onProgress: log })
const forwardOptions = packagerName === "npm" ? " -- --legacy-peer-deps" : ""
await system.run(`npx expo install --fix${forwardOptions}`, { onProgress: log })

stopSpinner(unboxingMessage, "🧶")
}
Expand Down
2 changes: 1 addition & 1 deletion src/tools/packager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function installCmd(options: PackageRunOptions) {
} else if (options.packagerName === "yarn") {
return `yarn install${silent}`
} else if (options.packagerName === "npm") {
return `npm install${silent}`
return `npm install${silent} --legacy-peer-deps`
} else if (options.packagerName === "bun") {
return `bun install${silent}`
} else {
Expand Down

0 comments on commit e59d880

Please sign in to comment.