Node JS, Npm, Yarn Commands


All the NodeJS, Npm and Yarn commands

Index List:

  1. NodeJS Commands
  2. NPM Commands
  3. Yarn Commands

Node JS Commands

Commands Description
node -V Checks the version of NodeJs you have

NPM Commands

Commands Description
npm init Creates the Npm files you need in the current working directory
npm [command] help To get help for a particular command, use the command
npm list Shows all the Npm packages installed locally in the project
npm list -g Shows all the Npm packages installed globally on your system
npm install Checks for package.json file and installs all the packages in the package.json manifesto
npm install [package_name] Installs npm package locally
npm install -g [package_name] Install a npm package globally on your system.
npm install [package_name] -S Installs npm package as normal Dependency (this is no longer needed as by default npm install to normal dependencies)
npm install [package_name] -D Installs npm package as a Dev Dependency
npm update Updates all the local specified package to the newest version
npm update [package_name] Updates the local specified package to the newest version
npm uninstall [package_name] Uninstalls the specified package
npm uninstall [package_name] -g Uninstalls the specified package globally

Yarn Commands

Commands Description
yarn install Install all the dependencies listed within package.json in the local node_modules folder.
yarn start If this is setup in the yarn.json it should start the live server for the project
yarn init Creates the Yarn files you need in the current working directory
yarn add [package] Installs package locally
yarn add [package]@[version] Installs specific version of package locally
yarn add [package] --dev Installs package as dev dependencies
yarn remove [package] Yarn Removes package from project
yarn upgrade Upgrades all major package changes does not upgrade small number versioning
yarn upgrade [package] Upgrades a speficied package