diff --git a/packages/bazel/src/builders/bazel.ts b/packages/bazel/src/builders/bazel.ts
index 24c5369a8d..e6e1a124d0 100644
--- a/packages/bazel/src/builders/bazel.ts
+++ b/packages/bazel/src/builders/bazel.ts
@@ -8,6 +8,7 @@
///
import {spawn, spawnSync} from 'child_process';
+import {join} from 'path';
import {Observable, Subject} from 'rxjs';
export type Executable = 'bazel' | 'ibazel';
@@ -17,7 +18,8 @@ export function runBazel(
projectDir: string, executable: Executable, command: Command, workspaceTarget: string,
flags: string[]): Observable {
const doneSubject = new Subject();
- const buildProcess = spawn(executable, [command, workspaceTarget, ...flags], {
+ const bin = join(projectDir, 'node_modules', '.bin', executable);
+ const buildProcess = spawn(bin, [command, workspaceTarget, ...flags], {
cwd: projectDir,
stdio: 'inherit',
shell: false,
@@ -35,7 +37,8 @@ export function runBazel(
}
export function checkInstallation(executable: Executable, projectDir: string) {
- const child = spawnSync(executable, ['version'], {
+ const bin = join(projectDir, 'node_modules', '.bin', executable);
+ const child = spawnSync(bin, ['version'], {
cwd: projectDir,
shell: false,
});
diff --git a/packages/bazel/src/builders/index.ts b/packages/bazel/src/builders/index.ts
index 42785c8c34..cf268067fc 100644
--- a/packages/bazel/src/builders/index.ts
+++ b/packages/bazel/src/builders/index.ts
@@ -11,7 +11,7 @@
import {BuildEvent, Builder, BuilderConfiguration, BuilderContext} from '@angular-devkit/architect';
import {getSystemPath, resolve} from '@angular-devkit/core';
import {Observable, of } from 'rxjs';
-import {catchError, map, tap} from 'rxjs/operators';
+import {catchError, map} from 'rxjs/operators';
import {checkInstallation, runBazel} from './bazel';
import {Schema} from './schema';
@@ -28,7 +28,8 @@ class BazelBuilder implements Builder {
if (!checkInstallation(executable, projectRoot)) {
throw new Error(
`Could not run ${executable}. Please make sure that the ` +
- `"${executable}" command is available in the $PATH.`);
+ `"${executable}" command is installed by running ` +
+ `"npm install" or "yarn install".`);
}
// TODO: Support passing flags.