fix(ci): ERR_PNPM_ADDING_TO_ROOT for wrangler

This commit is contained in:
Neko Ayaka
2025-11-26 00:02:54 +08:00
parent e3eab12488
commit 0be9559c1e
@@ -54,6 +54,20 @@ jobs:
with:
node-version: lts/*
cache: pnpm
# NOTICE:
#
# Here installing wrangler to global is required, or otherwise:
# ERR_PNPM_ADDING_TO_ROOT Running this command will add the dependency to the workspace root...
# error occurs.
#
# Since https://github.com/cloudflare/wrangler-action/pull/339#issuecomment-2667622947 rejected the -g support
# by saying un-reasonable 'I'm not sure if it's common ... to install packages to the global scope, ... might be introducing some unintended side effects.'
#
# Clearly I think installing with `<packageManager> install` brings more unintended side effects...
#
# As suggested by https://github.com/cloudflare/wrangler-action/issues/181#issuecomment-2127990708, we should pre-install
# with our package manager and then use it in the action.
- run: pnpm i -g wrangler@4
- run: pnpm install --frozen-lockfile
- run: pnpm run build:packages
- run: ${{ matrix.command }}