Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

fix(cli): run medusa via yarn/pnpm-exec on Cloud-style yarn templates

vholika50a008f3bce
diff --git a/packages/cli/src/utils/create-db.ts b/packages/cli/src/utils/create-db.ts
index 6b30e15ba..cec8b1837 100644
--- a/packages/cli/src/utils/create-db.ts
+++ b/packages/cli/src/utils/create-db.ts
@@ -294,11 +294,13 @@ async function runMigrations({ projectDir, spinner: parentSpinner }: DbSetupArgs
? ["bun", "run", "build"]
: ["npm", "run", "build"];
- const runnerCmd = packageManager === "pnpm"
- ? ["pnpm", "dlx"]
- : packageManager === "bun"
- ? ["bunx"]
- : ["npx"];
+ const runnerCmd = packageManager === "yarn"
+ ? ["yarn"]
+ : packageManager === "pnpm"
+ ? ["pnpm", "exec"]
+ : packageManager === "bun"
+ ? ["bunx"]
+ : ["npx"];
try {
// Build first - compiles TypeScript so ts-node is not needed
@@ -325,11 +327,13 @@ async function createAdminInvite({ projectDir }: { projectDir: string }): Promis
const apiDir = path.join(projectDir, API_DIR);
const packageManager = await getPackageManager(apiDir);
- const runnerCmd = packageManager === "pnpm"
- ? ["pnpm", "dlx"]
- : packageManager === "bun"
- ? ["bunx"]
- : ["npx"];
+ const runnerCmd = packageManager === "yarn"
+ ? ["yarn"]
+ : packageManager === "pnpm"
+ ? ["pnpm", "exec"]
+ : packageManager === "bun"
+ ? ["bunx"]
+ : ["npx"];
try {
const result = await execa(runnerCmd[0], [...runnerCmd.slice(1), "medusa", "user", "-e", ADMIN_EMAIL, "--invite"], {