diff --git a/internal/node/node_repositories.bzl b/internal/node/node_repositories.bzl index 111010a3..a5fb2d58 100755 --- a/internal/node/node_repositories.bzl +++ b/internal/node/node_repositories.bzl @@ -584,11 +584,7 @@ if %errorlevel% neq 0 exit /b %errorlevel% # The entry points for yarn for osx/linux and windows. # Runs yarn using appropriate node entry point. - # 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. + # Set YARN_IGNORE_PATH=1 so it doesn't go throug our .yarn/releases/yarn.sh wrapper if not is_windows: # Yarn entry point repository_ctx.file( @@ -597,7 +593,7 @@ if %errorlevel% neq 0 exit /b %errorlevel% # Generated by node_repositories.bzl # Immediately exit if any command fails. set -e -unset YARN_IGNORE_PATH +export YARN_IGNORE_PATH=1 {get_script_dir} "$SCRIPT_DIR/{node}" "$SCRIPT_DIR/{script}" "$@" """.format( @@ -617,7 +613,7 @@ set -e """ + GET_SCRIPT_DIR + "".join([ """ echo Running yarn "$@" in {root} -unset YARN_IGNORE_PATH +export YARN_IGNORE_PATH=1 (cd "{root}"; "$SCRIPT_DIR/{node}" "$SCRIPT_DIR/{script}" "$@") """.format( root = repository_ctx.path(package_json).dirname, @@ -632,7 +628,7 @@ unset YARN_IGNORE_PATH "bin/yarn.cmd", content = """@echo off SET SCRIPT_DIR=%~dp0 -SET "YARN_IGNORE_PATH=" +SET "YARN_IGNORE_PATH=1" "%SCRIPT_DIR%\\{node}" "%SCRIPT_DIR%\\{script}" %* """.format( node = paths.relativize(node_entry, "bin"), @@ -647,7 +643,7 @@ SET SCRIPT_DIR=%~dp0 """ + "".join([ """ echo Running yarn %* in {root} -SET "YARN_IGNORE_PATH=" +SET "YARN_IGNORE_PATH=1" cd /D "{root}" CALL "%SCRIPT_DIR%\\{node}" "%SCRIPT_DIR%\\{script}" %* if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/internal/npm_install/npm_install.bzl b/internal/npm_install/npm_install.bzl index d158779b..d01a6457 100755 --- a/internal/npm_install/npm_install.bzl +++ b/internal/npm_install/npm_install.bzl @@ -772,17 +772,13 @@ def _yarn_install_impl(repository_ctx): # The entry points for npm install for osx/linux and windows if not is_windows_host: # Prefix filenames with _ so they don't conflict with the npm packages. - # 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. + # Set YARN_IGNORE_PATH=1 so it doesn't go throug our .yarn/releases/yarn.sh wrapper repository_ctx.file( "_yarn.sh", content = """#!/usr/bin/env bash # Immediately exit if any command fails. set -e -unset YARN_IGNORE_PATH +export YARN_IGNORE_PATH=1 (cd "{root}"; "{yarn}" {yarn_args}) """.format( root = root, @@ -795,7 +791,7 @@ unset YARN_IGNORE_PATH repository_ctx.file( "_yarn.cmd", content = """@echo off -set "YARN_IGNORE_PATH=" +set "YARN_IGNORE_PATH=1" cd /D "{root}" && "{yarn}" {yarn_args} """.format( root = root,