From b87dba49f0a0b0ee2353fa596ed6bf9a9e693a53 Mon Sep 17 00:00:00 2001 From: Austin Burdine Date: Mon, 11 Nov 2024 20:33:29 -0500 Subject: [PATCH] fix(yarn): passthrough NODE_OPTIONS env var to yarn install closes #1898 - passthrough NODE_OPTIONS env var to yarn install if set --- lib/tasks/yarn-install.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/tasks/yarn-install.js b/lib/tasks/yarn-install.js index cd9395d13..5b601d8de 100644 --- a/lib/tasks/yarn-install.js +++ b/lib/tasks/yarn-install.js @@ -95,9 +95,16 @@ module.exports = function yarnInstall(ui, archiveFile) { args.push('--ignore-engines'); } + const env = {NODE_ENV: 'production', YARN_IGNORE_PATH: 'true'}; + // #1898: pass through NODE_OPTIONS so max_old_space_size can be configured + // in memory-constrained environments + if (process.env.NODE_OPTIONS) { + env.NODE_OPTIONS = process.env.NODE_OPTIONS; + } + const observable = yarn(args, { cwd: ctx.installPath, - env: {NODE_ENV: 'production', YARN_IGNORE_PATH: 'true'}, + env, observe: true, verbose: ui.verbose || false });