Node.jsλ︎
Node.js is an environment to run JavaScript on the operating system, without the need for a browser.
Node.js is useful for running JavaScript tools and server-side services.
Installλ︎
The nodejs package available in Ubuntu required a scary amount of dependencies, so it may be preferable to install nodejs locally, in your own account. This does mean node is only available to this specific user account.
Avoid nodejs debian packages when using Neovim Mason
Mason is a Neovim plugin to manage installation of LSP servers, format and lint tools.
The debian packages potentially cause issues with Mason updates for specific format and lint tools.
Install Node.js via the Linux archive available from the Nodejs Website - Download
Download the relevant version of nodejs from the website, either the Long Term Support version (recommended) or the latest release
Create a suitable directory path to extract the downloaded nodejs archive to
Extract the downloaded nodejs archive into this path
The
tar
flag-J
uses the XZ compression algorithm,v
for verbose list of extracted files,x
to extract all files,f
to specify file (or remote file, tape drive)
Create a symbolic link called current that points to the top level directory of the nodejs archive just unpacked, e.g. node-v
Add nodejs directory to the execution path, so that any additional node executables will automatically be included
Edit the ~/.zshenv
file, adding a conditional path entry on the nodejs directory existing
## Nodejs local install
if [[ -d $HOME/.local/apps/nodejs/current ]]; then
path=($HOME/.local/apps/nodejs/current/bin(/N) $path)
fi
Use path+=($HOME/.local/apps/nodejs/current/bin(/N))
instead to append the nodejs bin directory to the end of the PATH.
Open a new terminal to pick up the change or source the .zshenv
file in an existing terminal
Install using brew.sh and the Homebrew Formulae for node