From 3bf5fdd0c568bd42d2667fd437fa8abcfeba52c1 Mon Sep 17 00:00:00 2001 From: Vadim Kazakov Date: Mon, 24 Oct 2022 16:57:04 -0600 Subject: [PATCH] Update yarn version check Ensure version check is run inside the project workspace, i.e. the directory with package.json --- internal/npm_install/npm_install.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/npm_install/npm_install.bzl b/internal/npm_install/npm_install.bzl index fc2e2ee6c9..df4fa76936 100644 --- a/internal/npm_install/npm_install.bzl +++ b/internal/npm_install/npm_install.bzl @@ -836,7 +836,10 @@ check if yarn is being run by the `npm_install` repository rule.""", ) def _detect_yarn_version(rctx, yarn): - result = rctx.execute(yarn + ["--version"]) + result = rctx.execute( + yarn + ["--version"], + working_directory = str(rctx.path(rctx.attr.package_json).dirname), + ) if result.return_code: fail("yarn --version failed: %s (%s)" % (result.stdout, result.stderr)) if result.stdout.startswith("1."):