From 6baf76b7716852374e9f05d7cda3c7938e8e9630 Mon Sep 17 00:00:00 2001 From: Tyler Scott Williams Date: Wed, 13 Nov 2024 08:43:45 -0700 Subject: [PATCH] fix(cli): include ajv in devDependencies for Expo Router and npm (#2842 by @coolsoftwaretyler) * fix(cli): include ajv in devDependencies for Expo Router and npm * fix(cli): specify ajv devDependency, but only when necessary --- src/commands/new.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/commands/new.ts b/src/commands/new.ts index 0fa2e2765..c2bb4e8d6 100644 --- a/src/commands/new.ts +++ b/src/commands/new.ts @@ -750,6 +750,11 @@ module.exports = { // do base install const installCmd = packager.installCmd({ packagerName }) await system.run(installCmd, { onProgress: log }) + // If they chose npm and also Expo Router, we need to run npm install ajv@^8 --legacy-peer-deps. + // see https://github.com/infinitered/ignite/issues/2840 + if (packagerName === "npm" && experimentalExpoRouter) { + await system.run(`npm install ajv@^8 --legacy-peer-deps`, { onProgress: log }) + } // now that expo is installed, we can run their install --fix for best Expo SDK compatibility const forwardOptions = packagerName === "npm" ? " -- --legacy-peer-deps" : "" await system.run(`npx expo install --fix${forwardOptions}`, { onProgress: log })