Skip to content

Latest commit

 

History

History
122 lines (96 loc) · 1.99 KB

File metadata and controls

122 lines (96 loc) · 1.99 KB

JavaScript / Node Dev Environment Management

Three ways to get Node + npm on your machine, from simplest (system package) to per-project version management.

[Option-1]: Setup system nodejs & npm

Install using system package manager

paru -S nodejs npm

# Update all system packages
paru -Syu

Check version number

node -v
npm -v

[Option-2]: Use nvm

Install Node Version Manager

paru -S nvm

Look for node versions to install and check for installed versions

nvm ls-remote
nvm list                # or, `nvm ls`

Install the preferred node versions to nvm

nvm install <version>
nvm install --lts       # install the latest LTS version

Set a version to be used

  1. Only for the current terminal session
nvm use <version>
  1. For all terminal sessions (set as default)
nvm alias default <version>
  1. To use a specific version for a project
  • Create a .nvmrc file in project root
echo "<version>" > .nvmrc
  • Install and use the specified version
nvm install
nvm use

Check version number

node -v
npm -v

[Option-3]: Use fnm (Not compatible with nvm)

Install Fast Node Manager

paru -S fnm

Look for node versions to install and check for installed versions

fnm list-remote
fnm list

Install the preferred node versions to fnm

fnm install <version>

Set a version to be used

  1. Only for the current terminal session
fnm use <version>
  1. For all terminal sessions (set as default)
fnm default <version>
  1. To use a specific version for a project
  • Create a .nvmrc or .node-version file in project root
echo "<version>" > .node-version
  • Install the specified version
fnm install

Auto-detect and set node version (as set in .node-version OR .nvmrc)

This is a global setting

eval "$(fnm env --use-on-cd)"

Check version number

node -v
npm -v