From 9ca89b3e13d47e146989cfabb916d6599d140f03 Mon Sep 17 00:00:00 2001 From: situ2001 Date: Thu, 31 Oct 2024 11:13:50 +0800 Subject: [PATCH] fix(cli): reset `NODE_ENV` to ensure install command run in dev mode (#12338) --- .changeset/itchy-flowers-report.md | 5 +++++ packages/astro/src/cli/install-package.ts | 8 +++++++- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 .changeset/itchy-flowers-report.md diff --git a/.changeset/itchy-flowers-report.md b/.changeset/itchy-flowers-report.md new file mode 100644 index 0000000000..3c8e41c879 --- /dev/null +++ b/.changeset/itchy-flowers-report.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Resets `NODE_ENV` to ensure install command run in dev mode diff --git a/packages/astro/src/cli/install-package.ts b/packages/astro/src/cli/install-package.ts index d61a752dea..8dfd7c6c59 100644 --- a/packages/astro/src/cli/install-package.ts +++ b/packages/astro/src/cli/install-package.ts @@ -144,7 +144,13 @@ async function installPackage( await exec( installCommand.pm, [installCommand.command, ...installCommand.flags, ...installCommand.dependencies], - { nodeOptions: { cwd: cwd } }, + { + nodeOptions: { + cwd, + // reset NODE_ENV to ensure install command run in dev mode + env: { NODE_ENV: undefined }, + } + }, ); spinner.succeed();