You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: contribute/document-preview.md
+33-33Lines changed: 33 additions & 33 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,57 +17,57 @@ Pulsar documentation is built using [Docusaurus](https://docusaurus.io/). To pre
17
17
18
18
To verify docs are built correctly before submitting a contribution, you should set up your local environment to build and display the docs locally.
19
19
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)
21
21
* Corepack available and enabled (`corepack enable`)
22
22
* 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.
23
23
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
25
41
26
42
```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
34
46
corepack enable
35
47
```
36
48
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
+
37
51
#### Troubleshooting Corepack installation - Homebrew installations on macOS or Linux
38
52
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.
41
54
42
-
Some commands to fix the `corepack` installation:
55
+
To recover:
43
56
44
57
```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
52
59
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
62
65
corepack enable
63
66
```
64
67
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.
68
69
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.
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."
24
38
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."
0 commit comments