Dashboard › superset › Session 071H9JFSqXXn
071H9JFSqXXnSLahgI need to understand why npm install -g npm@latest might be failing in a GitHub Actions workflow running on ubuntu-latest with Node.js 22 (set up via actions/setup-node@v4).
Research the following:
npm install -g npm@latest on recent Node.js versions in GitHub Actionsnpm install -g npm@latest to fail (npm 11 was released in early 2025)corepack or package manager settings in the runner could interfere"packageManager": "pnpm@10.28.0" — check if corepack being enabled could cause npm install -g to fail because it would try to enforce pnpm insteadThe specific error from the GitHub Actions run is: "Process completed with exit code 1" on the step named "Upgrade npm for OIDC trusted publishing" which runs:
npm install -g npm@latest
npm --version
The workflow uses actions/setup-node@v4 with node-version: 22.
Note: The package.json contains "packageManager": "pnpm@10.28.0" which means corepack may intercept npm commands.
Return your findings about the most likely cause of the failure.
I'll research this systematically. Let me gather information from multiple sources in parallel.
[tool results provided]
Let me dig deeper into the specific issues — corepack interaction with packageManager field, and npm 11 breaking changes.
[tool results provided]
Now let me search for the specific corepack + npm interaction issue and check the actions/setup-node behavior regarding corepack:
[tool results provided]
Now let me look at the exact corepack issue #690 which is precisely about npm global install being blocked in pnpm projects:
[tool results provided]
I now have all the evidence I need. Let me also quickly check the exact workflow file to understand the context better:
[tool results provided]
[tool results provided]
Let me check the full workflow context around that step:
[tool results provided]
Now I have the complete picture. Here are my findings:
npm install -g because packageManager is set to pnpmThis is a known bug filed as nodejs/corepack#690 — "npm global install / uninstall blocked in yarn/pnpm project if npm enabled".
actions/setup-node@v4 with node-version: 22 installs Node.js 22.x, which ships with Corepack bundled (up to but not including Node.js 25, where it's removed).
Node.js 22.22.x ships with Corepack 0.34.6 and npm 10.9.8 (from the changelog). Corepack is included but historically disabled by default — however, recent Node.js 22 versions have increasingly active corepack behavior when it detects a packageManager field.
Your package.json declares "packageManager": "pnpm@10.28.0" (package.json:6). When Corepack is enabled (or when its shims are active), it reads this field and enforces that only pnpm should be used as the package manager for this project.
When npm install -g npm@latest runs, Corepack intercepts the npm command. Even though this is a global install (-g), Corepack still checks the local package.json, finds "packageManager": "pnpm@10.28.0", and refuses to run npm with an error like:
This project is configured to use pnpm because /path/to/package.json has a "packageManager" field
The step fails with exit code 1.
packageManager field.ubuntu-latest runner image may have started enabling corepack or the shims may be present on PATH from the actions/setup-node installation. ...