Configs

Node.js Node.js

Install Node.js via fnm

The Fast Node Manager (fnm) is a fast, cross-platform node version manager written in Rust. Earlier I was using nvm

On the Node.js download via package manager page, select the highest LTS Node version, on Linux and using fnm to get a list of bash commands you’ll enter in the terminal:

Common fnm commands

fnm -h # Commands Help
fnm -V # Get FNM version
fnm list # or "fnm ls" to list your installed node versions
fnm list-remote # list all available remote node versions
fnm install 22 # install a specific node version
fnm current # node version you're currently using
fnm use 22 # switch to a node version
fnm use --install-if-missing 20 # install and use specific node version
fnm uninstall 22

We use fnm to install Node, and pnpm as the package manager for our projects

Install pnpm

pnpm is a fast, space-efficient package manager for Node. It re-uses packages across the node_modules/ folders of all your packages with the help of symlinks. It also has a robust lockfile management mechanism making dependency resolution much better, leading to faster downloads and builds

npm vs pnpm commands

npm command pnpm equivalent
npm install (all project packages) pnpm install
npm install <package> (also -g or -D flags) pnpm add <package>
npm run <scriptname> pnpm <scriptname>
npx <package> pnpm dlx <package>