From 1363baea28da820e2d5563ab0476d213c39217d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Jona=C5=A1?= Date: Thu, 27 Jul 2023 15:54:23 +0200 Subject: [PATCH] fix(nextjs): builder should work with pnp (#18325) --- packages/next/src/executors/build/build.impl.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/next/src/executors/build/build.impl.ts b/packages/next/src/executors/build/build.impl.ts index eb0678c66f76b..4481e5f74a820 100644 --- a/packages/next/src/executors/build/build.impl.ts +++ b/packages/next/src/executors/build/build.impl.ts @@ -1,6 +1,7 @@ import 'dotenv/config'; import { ExecutorContext, + getPackageManagerCommand, logger, readJsonFile, writeJsonFile, @@ -53,11 +54,11 @@ export default async function buildExecutor( process.env.NX_NEXT_OUTPUT_PATH ??= outputPath; const args = createCliOptions({ experimentalAppOnly, profile, debug }); - const command = `npx next build ${args.join(' ')}`; + const pm = getPackageManagerCommand(); + const command = `${pm.exec} next build ${projectRoot} ${args.join(' ')}`; const execSyncOptions: ExecSyncOptions = { stdio: 'inherit', encoding: 'utf-8', - cwd: projectRoot, }; try { execSync(command, execSyncOptions);