Nodejs Cheat Sheet
12 Aug 2022 - Alejandro Piña
Basic nodejs commands that are used in my day to day
Working with NVM (Node Version Manager)
Install NVM
Note: You can check the latest version from https://github.com/nvm-sh/nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
Available nodejs remote versions
nvm ls-remote
Install some nodejs version available in the list of remote versions
nvm install 14.15.0
List local installed nodejs versions
nvm ls
Choose a version from installed nodejs versions
nvm use 14.15.0
Change default node version
nvm alias default XX.XX.X
Working with NPM (Node Package Manger)
Initialize a NodeJS project
npm init
Install a package
-D
package appear indevDependecies
section in filepackage.json
-P
package apper independencies
section in filepackage.sjon
-g
install package in the global scope
Note: without version its installs the latest version
npm i @angular/core@13.0.0
Install all packages listed in the section dependencies
and devDependencies
npm install
Working with NPX (Node Package Execute)
Execute a local package
npx ng build