Skip to content

Commit 42b5eec

Browse files
tianzhouclaude
andcommitted
fix: bootstrap npm upgrade without broken system npm
Node 22.22.2 ships with broken npm (missing promise-retry module), so any npm command fails. Download npm 11 tarball directly via curl and use it to install itself globally, bypassing the broken system npm. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 5c91f00 commit 42b5eec

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

.github/workflows/npm-publish.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,13 @@ jobs:
5858
node-version: "22"
5959

6060
# Upgrade npm for OIDC trusted publishing support (requires npm 11.5+)
61+
# Bootstrap without npm since Node 22.22.2 ships with broken npm (missing promise-retry)
6162
- name: Upgrade npm
6263
run: |
63-
npm install -g npm@11
64+
npm_tarball=$(curl -fsSL https://registry.npmjs.org/npm/latest-11 | node -p "JSON.parse(require('fs').readFileSync(0,'utf8')).dist.tarball")
65+
curl -fsSL "$npm_tarball" | tar xz -C /tmp
66+
node /tmp/package/bin/npm-cli.js install -g npm@11
67+
rm -rf /tmp/package
6468
echo "npm version: $(npm --version)"
6569
6670
# Install pnpm for faster and more reliable package management

0 commit comments

Comments
 (0)