The following fixed the issue:
brew uninstall node
brew install nvm
nvm use 18.18.2
brew install glibc
echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/glibc/bin:$PATH"' >> ~/.profile
echo 'export PATH="/home/linuxbrew/.linuxbrew/opt/glibc/sbin:$PATH"' >> ~/.profile
source ~/.profile
Now I get:
user@server:~/horizon/hz$ node --version
v18.20.6
Note: I first tried to solve the issue by running
brew uninstall node
brew install node@18
but that gave me the error:
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.25' not found (required by node)