diff --git a/packages/nx/src/utils/package-json.ts b/packages/nx/src/utils/package-json.ts index 3e46cc2dff513..ea6dda74d0a66 100644 --- a/packages/nx/src/utils/package-json.ts +++ b/packages/nx/src/utils/package-json.ts @@ -177,8 +177,8 @@ export function readTargetsFromPackageJson( const { scripts, nx, private: isPrivate } = packageJson ?? {}; const res: Record = {}; const includedScripts = nx?.includedScripts || Object.keys(scripts ?? {}); - packageManagerCommand ??= getPackageManagerCommand(); for (const script of includedScripts) { + packageManagerCommand ??= getPackageManagerCommand(); res[script] = buildTargetFromScript(script, scripts, packageManagerCommand); } for (const targetName in nx?.targets) {