Skip to content

Commit 5a2af71

Browse files
committed
fix: unset YARN_IGNORE_PATH in yarn_install before calling yarn
Unset YARN_IGNORE_PATH before calling yarn incase it is set so that .yarnrc yarn-path is followed if set. This is for the case when calling bazel from yarn with `yarn bazel ...` and yarn follows yarn-path in .yarnrc it will set YARN_IGNORE_PATH=1 which will prevent the bazel call into yarn from also following the yarn-path as desired.
1 parent 9fb080b commit 5a2af71

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

internal/npm_install/npm_install.bzl

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,12 +339,18 @@ def _yarn_install_impl(repository_ctx):
339339

340340
# The entry points for npm install for osx/linux and windows
341341
if not is_windows_host:
342-
# Prefix filenames with _ so they don't conflict with the npm packages
342+
# Prefix filenames with _ so they don't conflict with the npm packages.
343+
# Unset YARN_IGNORE_PATH before calling yarn incase it is set so that
344+
# .yarnrc yarn-path is followed if set. This is for the case when calling
345+
# bazel from yarn with `yarn bazel ...` and yarn follows yarn-path in
346+
# .yarnrc it will set YARN_IGNORE_PATH=1 which will prevent the bazel
347+
# call into yarn from also following the yarn-path as desired.
343348
repository_ctx.file(
344349
"_yarn.sh",
345350
content = """#!/usr/bin/env bash
346351
# Immediately exit if any command fails.
347352
set -e
353+
unset YARN_IGNORE_PATH
348354
(cd "{root}"; "{yarn}" {yarn_args})
349355
""".format(
350356
root = root,
@@ -357,6 +363,7 @@ set -e
357363
repository_ctx.file(
358364
"_yarn.cmd",
359365
content = """@echo off
366+
set "YARN_IGNORE_PATH="
360367
cd "{root}" && "{yarn}" {yarn_args}
361368
""".format(
362369
root = root,

0 commit comments

Comments
 (0)