Skip to content

chore: fix c8 dependency breakage on node <= 18#8958

Merged
gcf-merge-on-green[bot] merged 1 commit into
mainfrom
pearigee-fix-release
Jul 23, 2026
Merged

chore: fix c8 dependency breakage on node <= 18#8958
gcf-merge-on-green[bot] merged 1 commit into
mainfrom
pearigee-fix-release

Conversation

@pearigee

@pearigee pearigee commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

The Issue

The error blocking release:

 ERR_PNPM_UNSUPPORTED_ENGINE  Unsupported environment (bad pnpm and/or Node.js version)

This error happened while installing the dependencies of c8@10.1.3
 at test-exclude@7.0.2
 at minimatch@10.2.5

Your Node version is incompatible with "brace-expansion@5.0.8".

Expected version: 20 || >=22
Got: v18.20.8

This is happening because the package's manifest has an engines.node field specified.
To fix this issue, install the required Node version.

The Fix

Here is the exact dependency chain that triggered the failure:

c8@10.1.3
  └── test-exclude@7.0.2
      └── minimatch@10.2.5
          └── brace-expansion@5.0.8 (requires node: "20 || >=22")
  1. c8@10.1.3 pulled in test-exclude@7.0.2.
  2. test-exclude@7.0.2 updated its dependency to minimatch@10.2.5.
  3. minimatch@10.2.5 pulled in brace-expansion@5.0.8.
  4. brace-expansion@5.0.8 strictly requires Node 20 || >=22 in its engines specification, breaking installation under Node 18.

As a result, we need to pin to an older version of C8 for versions of Node older than 18. Rather that implementing a global override, updating the .pnpmfile.cjs enables us to do a targeted override ONLY for Node 18. That means that as we upgrade to Node 22, every other package can continue to use 10+ like they do currently.


Why this works

Note, this works because in our CI we explicitly set the PNPM file on install: https://github.com/googleapis/google-cloud-node/blob/main/ci/run_single_test.sh#L45

@pearigee
pearigee requested a review from a team as a code owner July 23, 2026 20:23

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a workaround in .pnpmfile.cjs to override the c8 dependency to ^9.1.0 when running on Node.js versions 18 or below, ensuring CI compatibility. The review feedback suggests using context.log instead of console.log to prevent stdout pollution and recommends simplifying the Node.js major version extraction by parsing process.versions.node directly.

Comment thread .pnpmfile.cjs
@pearigee pearigee added the automerge Merge the pull request once unit tests and other checks pass. label Jul 23, 2026
@gcf-merge-on-green
gcf-merge-on-green Bot merged commit c9b5053 into main Jul 23, 2026
36 checks passed
@gcf-merge-on-green gcf-merge-on-green Bot removed the automerge Merge the pull request once unit tests and other checks pass. label Jul 23, 2026
@gcf-merge-on-green
gcf-merge-on-green Bot deleted the pearigee-fix-release branch July 23, 2026 20:36
@pearigee

Copy link
Copy Markdown
Contributor Author

This contributes to unblocking #8904 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants