Skip to main content

2026-11-30 · 4 min read

Upgrading Node 26 and pnpm 12 on the machine that serves the site

DevOps

Translated from the Chinese original: read it in Chinese

This site has no cloud host: Next.js runs directly on a desktop at home, and deploys are done by a GitHub Actions runner on that same desktop. So "upgrading Node" is not editing a CI setting but replacing the very node.exe that production is using. This time I went from Node 24 to Node 26 LTS and pnpm from 11.7.0 to 12.23.0, and this post records the order and what I ran into.

First, do not touch the system Node

Before installing, I downloaded the no-install node-v26.13.1-win-x64.zip from nodejs.org (checking SHA256 against the official SHASUMS256.txt), unpacked it into a temp folder, and ran the full verification with it:

  • Type check, lint and unit tests: run directly with that node.exe
  • Build plus E2E: this site's test script uses "the node that started it" to run the build and the server, so starting it with Node 26 means the whole run happens on Node 26

The admin database uses Node's built-in node:sqlite, which I also checked. Only after everything passed did I ask for the installation with administrator rights.

After installing, no reboot, and node -v still says 24

Node on the desktop is installed by MSI at C:\Program Files\nodejs. Before installing I counted 80 node.exe processes using that file: the site itself, background processes of various dev tools, and other test servers.

When an MSI quiet install runs into files in use, it does not pop up to ask; it schedules the replacement for the next boot. Without a reboot, the installer says "success" and node -v still shows the old version. This machine has hit "said fixed but did not take effect" before, so this time a reboot was in the plan from the start, and I always check with node -v afterwards.

Both the live site and the deploy runner are "at boot" scheduled tasks (they run without anyone logging in), so they came back up by themselves after the reboot.

After the reboot the outside was down for 2 minutes

Checking right after the reboot, the public /api/v1 returned 530 (Cloudflare cannot reach the origin), and the Cloudflare Tunnel service was Stopped with exit code 1077, meaning "nobody has tried to start it since boot". The home page returned 200, but that was Cloudflare's cache.

I almost asked for the service to be started by hand, and on a second look at its configuration found it is "Automatic (Delayed Start)". Windows waits until the other automatic services are up and starts this class about 2 minutes later. The actual record:

  • 23:11:26 boot
  • 23:13:41 Cloudflared service started
  • 23:13:48 public /api/v1 returned 200

So it was not broken; it is a gap that happens on every reboot. It needs to be written down, or the next reboot will scare me again.

pnpm 12: the hard-coded pnpm.cjs in the deploy script is gone

To avoid depending on the PATH of the runner's environment, the deploy script runs pnpm's JS entry directly with node:

$pnpmEntry = Join-Path $env:APPDATA "npm\node_modules\pnpm\bin\pnpm.cjs"

Before upgrading pnpm, I used npm pack pnpm@12.23.0 to download the package and look at it (no install, no scripts run): pnpm 12 became a native executable, and the npm package's bin\ has only pnpm.mjs and pnpx.mjs, with pnpm.cjs gone. With the original code, Test-Path would fail and fall back to pnpm on PATH, and whether that runs depends on the runner's environment.

pnpm 11's bin\ has both pnpm.cjs and pnpm.mjs (the bin in package.json actually points to the .mjs), so I fixed the script and deployed first, then upgraded pnpm:

$pnpmEntry = @("bin\pnpm.mjs", "bin\pnpm.cjs") |
  ForEach-Object { Join-Path $env:APPDATA "npm\node_modules\pnpm\$_" } |
  Where-Object { Test-Path $_ } | Select-Object -First 1

In 12, pnpm.mjs is a small wrapper that finds the native executable and runs it, so it works with both 11 and 12.

Other things I confirmed:

  • 12 reads the lockfile written by 11 directly with --frozen-lockfile (still lockfileVersion: '9.0') without rewriting it, and the package store is the same one, so nothing is downloaded again
  • When running npm i -g pnpm@12.23.0, the npm bundled with Node 26 warns "install scripts not yet covered by allowScripts". It installed fine this time, with pnpm.cmd pointing to pnpm.exe. If npm ever really blocks it, add --allow-scripts=pnpm

The first deploy after the upgrade that actually had to install packages logged this:

pnpm install --frozen-lockfile (...\npm\node_modules\pnpm\bin\pnpm.mjs)
Packages: +175 -126
Done in 6.3s using pnpm v12.23.0

The order

The principle this time was "change one thing at a time, so when something breaks I know which":

  1. TypeScript 7 (another post)
  2. Node 26: verify with the portable build first, install as administrator, reboot, check, and only then push @types/node 26
  3. pnpm 12: fix the deploy script and deploy first, then upgrade pnpm, run the PR dry-run script by hand once (install packages, type check, unit tests, build), and only then update the docs

Every step was a separate commit and a separate deploy. All four deploys succeeded, with no rollback in between.

Type to search projects and posts too