Install nvm
Install or update nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bashIf zsh complains about insecure directories, ignore the warning and continue:
compaudit | xargs chmod g-wInstall the latest LTS node.js
List available remote versions:
nvm ls-remoteInstall the Latest LTS version:
nvm install 22.16.0
npm update -gVerity that node.js is installed and ready to use:
node --versionInstall essential npm global packages
npm i -g typescript eslint typescript-language-server ts-nodeTo update node.js and install globally installed packages:
nvm install 22.16.0 --reinstall-packages-from=20.11.1To check globally installed npm packages:
npm list -g --depth=0To update globally installed packages
npm update -gTroubleshooting
If your node version keeps reverting back to a specific old version after nvm use, check the nvm alias setting inside ~/.nvm/alias/default (It is safe to delete this file.).
Install Emacs lsp-mode
Make sure lsp-mode and tide-mode Emacs packages are installed & configured.
Run M-x lsp-install-server and select ts-ls, it will result in the following commands being executed:
npm i -g typescript-language-server
npm i -g typescript