Unverified 提交 e060f780 authored 作者: Will Chen's avatar Will Chen 提交者: GitHub

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: 's avatarcubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
上级 a70d16df
...@@ -69,7 +69,7 @@ async function executeAppLocalNode({ ...@@ -69,7 +69,7 @@ async function executeAppLocalNode({
event: Electron.IpcMainInvokeEvent; event: Electron.IpcMainInvokeEvent;
}): Promise<void> { }): Promise<void> {
const process = spawn( 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, cwd: appPath,
......
...@@ -19,7 +19,7 @@ export async function executeAddDependency({ ...@@ -19,7 +19,7 @@ export async function executeAddDependency({
const packageStr = packages.join(" "); const packageStr = packages.join(" ");
const { stdout, stderr } = await execPromise( const { stdout, stderr } = await execPromise(
`(pnpm add ${packageStr}) || (npm install ${packageStr})`, `(pnpm add ${packageStr}) || (npm install --legacy-peer-deps ${packageStr})`,
{ {
cwd: appPath, cwd: appPath,
}, },
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论