Node.js, npm, npx, yarn - huh?

npm basic nodejs javascript npx yarn
Node.js, npm, npx, yarn - huh?

Framework/Language: Node.js
Level: Beginners

What you will build/learn

This Codelab includes concepts/tools explanation and code snippets. To keep it simple, I have tried my best to explain things in the easiest way possible. Also, I have added some GIFs so that you can see those snippets in action.

Scope & Preferred for: 

This Codelab has been designed especially for those who are just beginning with Node and have some confusion about buzz words like npm, npx, node etc. 

Things you will learn

What is:

  • Node.js
  • NPM
  • Yarn 
  • NPX

Tools you will require

  • A computer/laptop with an internet connection. 



What is nvm? 😯
nvm is a great tool to Install `Node.js` and manage its versions. `nvm` supports POSIX-compliant shell (sh, dash, ksh, zsh, bash). In other words, you can use this tool on MacOS, Linux (Ubuntu, Debian, Arch etc) and Windows WSL (Window Subsystem for Linux). 

Why nvm instead of traditional way?
1- Makes it easy to install any version of node. You can switch between different versions anytime.
2- `nvm` sets the right permission while installing Node. So you won't need root permission (sudo) while installing global packages.

1-Installing nvm:
( 👉 Please check latest command from Here 🔗)

curl -o- | bash

or use wget.

Points to remember:
1- You can install through wget as well. Head to the link to see that.
2- Close the current shell/terminal after installing.
3- You might get an error if nvm doesn't find .bashrc/.zshrc. Create one before re-running above command. 


2- Installing node (Link)

nvm install node

Note: If you want to install any specific version then you check its command here.


There are many other alternatives of `nvm` like n, webi etc.