Skip to content

Commit d5da3ee

Browse files
committed
Upgrade to Node 24 in local configuration and documentation
1 parent 626546c commit d5da3ee

5 files changed

Lines changed: 56 additions & 40 deletions

File tree

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717

18-
FROM node:22-bookworm as build
18+
FROM node:24-bookworm AS build
1919

2020
WORKDIR /build-site
2121

contribute/document-preview.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,57 +17,57 @@ Pulsar documentation is built using [Docusaurus](https://docusaurus.io/). To pre
1717

1818
To verify docs are built correctly before submitting a contribution, you should set up your local environment to build and display the docs locally.
1919

20-
* Node v20 LTS (there are compatibility issues with Node v23)
20+
* Node v24 LTS (Node v22 LTS also works; the pinned version in `.nvmrc` and CI is v24)
2121
* Corepack available and enabled (`corepack enable`)
2222
* Although you can use Linux, macOS, or Windows to build locally the Pulsar documentation, macOS is the preferred build environment as it offers the most complete support for documentation building.
2323

24-
Installing prerequisites with [Homebrew](https://brew.sh/) on macOS or Linux:
24+
You can install Node.js with either **fnm** (recommended) or **Homebrew**. The repository ships a `.nvmrc` file, so fnm/nvm/asdf users will auto-select the right version.
25+
26+
#### Option 1: fnm (recommended)
27+
28+
[fnm](https://github.com/Schniz/fnm) is a fast, cross-platform Node version manager. It lets you run different Node versions per project without reinstalling, which is helpful when you contribute to multiple repositories.
29+
30+
```shell
31+
# install fnm (macOS/Linux via Homebrew; see https://github.com/Schniz/fnm for other installers incl. Windows)
32+
brew install fnm
33+
# add shell integration; pick the line for your shell and append it to ~/.zshrc, ~/.bashrc, or ~/.config/fish/config.fish
34+
eval "$(fnm env --use-on-cd --shell bash)"
35+
# install Node 24 LTS, enable corepack, and switch to it in the current shell (also picked up automatically from .nvmrc on 'cd' once shell integration is active)
36+
fnm install --corepack-enabled --use 24
37+
fnm default 24
38+
```
39+
40+
#### Option 2: Homebrew
2541

2642
```shell
27-
# uninstall any existing node installation
28-
brew uninstall node
29-
# install node v20 LTS
30-
brew install node@20
31-
# link node v20
32-
brew link node@20
33-
# enable corepack
43+
# install Node (Homebrew's default node formula)
44+
brew install node
45+
# enable corepack (bundled with Node); only needs to run once per Node install
3446
corepack enable
3547
```
3648

49+
If you need to pin Node to a specific LTS line (e.g. to match CI), use fnm (Option 1) — it's easier than juggling Homebrew's versioned formulae.
50+
3751
#### Troubleshooting Corepack installation - Homebrew installations on macOS or Linux
3852

39-
Docusaurus supports Node v18 LTS and v20 LTS so ensure you have one of these versions installed.
40-
Sometimes Homebrew has Corepack installed, but it's not available.
53+
After a `brew upgrade` that bumps Node, Corepack-managed `yarn`/`pnpm` symlinks in Homebrew's `bin` can become dangling and break `yarn`. Similarly, a stale standalone `yarn` package installed via Homebrew can shadow the Corepack-managed one.
4154

42-
Some commands to fix the `corepack` installation:
55+
To recover:
4356

4457
```shell
45-
# delete node symlinks if they exist
46-
brew unlink node
47-
# uninstall default node version
48-
brew uninstall node
49-
# uninstall yarn
50-
brew uninstall yarn
51-
# upgrade packages
58+
# upgrade packages so Node ships with a current Corepack
5259
brew upgrade
53-
# delete node@20 symlinks
54-
brew unlink node@20
55-
# install node v20 LTS if not already installed
56-
brew install node@20
57-
# recreate symlinks
58-
brew link node@20
59-
# delete broken symlinks in /opt/homebrew/bin
60-
find /opt/homebrew/bin -type l ! -exec test -e {} \; -delete
61-
# enable corepack, if the command fails, remove the conflicting files from `/opt/homebrew/bin` and try again
60+
# remove any stray yarn package (yarn should come from Corepack, not from Homebrew)
61+
brew uninstall yarn 2>/dev/null || true
62+
# delete broken symlinks in Homebrew's bin directory
63+
find "$(brew --prefix 2>/dev/null || echo "/opt/homebrew")/bin" -type l ! -exec test -e {} \; -delete
64+
# enable corepack; if the command fails, remove the conflicting files from the Homebrew bin directory and try again
6265
corepack enable
6366
```
6467

65-
Please also ensure that you have upgraded Homebrew packages to the latest versions. Run `brew upgrade` to upgrade all installed packages.
66-
67-
Don't install `yarn` separately from a package manager since it's included with `corepack`, which is bundled with `node@20`. If you're using Homebrew, uninstall any existing `yarn` installation with `brew uninstall yarn` to avoid conflicts.
68+
Don't install `yarn` separately from a package manager since it's included with Corepack, which is bundled with Node. If you're using Homebrew, uninstall any existing `yarn` installation with `brew uninstall yarn` to avoid conflicts.
6869

69-
If `corepack enable` fails due to file conflicts, verify that no legacy `corepack` or `yarn` package is already installed. If found, remove them. Removing `corepack` on updated Homebrew installations is not recommended since it uninstalls the `node@20` package.
70-
If `corepack enable` continues to fail due to conflicting files, manually remove the conflicting files from `/opt/homebrew/bin` and try again.
70+
If `corepack enable` continues to fail due to conflicting files, manually remove the conflicting files from the Homebrew bin directory (shown by `brew --prefix`) and try again.
7171

7272
### Preview changes
7373

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,6 @@
104104
},
105105
"packageManager": "yarn@3.5.0",
106106
"engines": {
107-
"node": ">=18.0"
107+
"node": ">=22.0"
108108
}
109109
}

preview.sh

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,27 @@ BUILD_VERSIONS="${BUILD_VERSIONS}]"
1818
echo "$BUILD_VERSIONS" >.build-versions.json
1919

2020
show_yarn_installation_help() {
21-
echo "yarn is not available. yarn comes with corepack. corepack is part of the node runtime package in Homebrew."
22-
echo "You will need to activate corepack by running:"
23-
echo "corepack enable"
21+
local brew_prefix
22+
brew_prefix="$(brew --prefix 2>/dev/null || echo "/opt/homebrew")"
23+
echo "*** yarn / Corepack is not working. ***"
24+
echo
25+
echo "If you see any of the following errors, the fix is almost always to run 'corepack enable':"
26+
echo " - 'command not found: yarn'"
27+
echo " - 'Internal Error: ... does not match the signature' / 'Cannot find matching keyid' (Corepack signature errors)"
28+
echo " - 'Cannot find module' errors when yarn starts"
29+
echo " - any other unexpected error from the Node.js package manager on a fresh machine"
30+
echo
31+
echo "Run this first:"
32+
echo " corepack enable"
33+
echo
34+
echo "Background: yarn is distributed via Corepack, which is bundled with the Node runtime."
35+
echo "Corepack must be activated once per Node installation before yarn can be used."
36+
echo
37+
echo "Install Node.js 24 LTS either with fnm (https://github.com/Schniz/fnm) or with Homebrew."
2438
echo "Don't install yarn separately from a package manager. With Homebrew, uninstall any existing yarn installation with 'brew uninstall yarn'"
25-
echo "You might have to run 'brew unlink node; brew link node; find /opt/homebrew/bin -type l ! -exec test -e {} \; -delete; corepack enable' to fix the installation."
26-
echo "If 'corepack enable' fails due to file conflicts, remove the conflictings files manually from /opt/homebrew/bin and try again."
39+
echo "If 'corepack enable' still fails, delete the broken symlinks in Homebrew's bin and run it again:"
40+
echo " find ${brew_prefix}/bin -type l ! -exec test -e {} \; -delete && corepack enable"
41+
echo "If it still fails due to file conflicts, remove the conflicting files manually from ${brew_prefix}/bin and try again."
2742
}
2843

2944
if ! command -v yarn &>/dev/null; then

0 commit comments

Comments
 (0)