Skip to content

Commit

Permalink
fix(core): workspaceRoot/node_modules/.bin should be in path during `…
Browse files Browse the repository at this point in the history
…nx exec`
  • Loading branch information
AgentEnder committed Feb 21, 2023
1 parent f8d4995 commit edd6fb5
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/nx/src/command-line/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import * as yargs from 'yargs-parser';

import { readNxJson } from '../config/configuration';
import { ProjectGraph, ProjectGraphProjectNode } from '../config/project-graph';
import { ProjectConfiguration } from '../config/workspace-json-project-json';
import {
createProjectGraphAsync,
readProjectsConfigurationFromProjectGraph,
Expand All @@ -17,6 +16,7 @@ import { PackageJson } from '../utils/package-json';
import { getPackageManagerCommand } from '../utils/package-manager';
import { workspaceRoot } from '../utils/workspace-root';
import { calculateDefaultProjectName } from './run-one';
import { env as appendLocalEnv } from 'npm-run-path';

export async function nxExecCommand(
args: Record<string, string[]>
Expand All @@ -28,7 +28,13 @@ export async function nxExecCommand(
const command = scriptArgV
.reduce((cmd, arg) => cmd + `"${arg}" `, '')
.trim();
execSync(command, { stdio: 'inherit' });
execSync(command, {
stdio: 'inherit',
env: {
...process.env,
...appendLocalEnv(),
},
});
} else {
// nx exec is being ran inside of Nx's context
return runScriptAsNxTarget(scriptArgV);
Expand Down

0 comments on commit edd6fb5

Please sign in to comment.