npm (short for Node Package Manager) is a package manager for the JavaScript programming language. With npm, developers can easily install and manage hundreds of thousands of packages from the npm registry, which is a public repository of open-source JavaScript packages. npm supports CLI (Command Line Interfacce) through which developers can perform various tasks such as installing packages, updating packages, removing packages, searching for packages, publishing packages, and managing dependencies.
Overall, npm is an essential tool for modern JavaScript development, making it easy to manage dependencies, speed up development, and improve the quality of code.
react:
A popular JavaScript library for building user interfaces.
react-router:
Declarative routing for React.
nodemon:
Automatically restart node application when file changes are detected.
express:
Fast, unopinionated, minimalist web framework for Node.js.
typescript:
TypeScript is a language for application scale JavaScript development.
mongoose:
A library for working with MongoDB databases in Node.js.
axios:
Promise based HTTP client for the browser and node.js
All the basic stuffs will be covered regarding npm and package.json file. All you need to do just install node in your system, and you are ready to go.
In here, I discussed regarding npm help documentations shown in the terminal. If you get ever stuck in the middle of a work, it is really annoying. Help documentation might come to rescue.
npm <command>
Command | Alias | Description |
---|---|---|
init | Create a package.json file | |
install | i | install all the dependencies in your project |
install <foo> | i <foo> | add the <foo> dependency to your project |
update | Update packages | |
uninstall | Remove a package | |
<command> --help | <command> -h | quick help on <command> |
help <term> | search for help on <term> (in a browser) | |
--help | -h | display help documentation |
--version | -v | show version |
1. How can you check your npm version?
npm -v
or,
npm --version
2. Print npm help documentation.
npm -h
or,
npm --help
3. Let you want to install something. But you need some documentation help. How can you get it?
npm i -h
or,
npm install --help
4. Okay, let's say, you need more details help documentation. What about in a browser based help documentation!! How can you get it?
npm help install
5. How can you create a package.json file by npm?
npm init
or, to skip questions,
npm init -y
This creates a package.json file in working directory. Open it and surf. It probably appears like this.

Flag | Meaning |
---|---|
-g | install globally |
--save-dev | install as a dev-dependency |
--save | (default) install as a dependency |
6. Suppose, you want to add `express` in your package.json under `dependencies`. How can you do that?
npm i express
Note: >
4.18.2 means:
major version . minor version . patch version
Version | Meaning |
---|---|
4.18.2 | dependency is not allowed to update to any version except this one. |
^4.18.2 | dependency is allowed to update to any minor or patch version, as long as the major version remains the same. |
~4.18.2 | dependency is allowed to update to any patch version, but not to any minor or major version. |
* | dependency is allowed to update to any version. |
latest | dependency must be latest version. |

7. If you want to install jest
as a dev dependency, what should you need to do?
npm i jest --save-dev

8. Is it possible to install multiple package at the same time?
npm install <package-1> <package-2> <package-3> .........
9. How can we install `nodemon` globally?
npm i nodemon -g
10. What is the meaning of npm install
?
It installs all the dependencies and dev-dependencies in package.json
To update a package: npm update <package>
To uninstall a package: npm uninstall <package>
"scripts": {
"start": "node index.js",
"dev": "nodemon dev.js"
},
To access this, type npm start
or npm run dev
in the terminal.
npx stands for Node Package eXecute. From version 5.2+, npx is used to execute node packages without the need to install them. With npx, you can run a package by simply specifying its name and version, and npx will download and execute it for you. This is particularly useful when you need to run a one-time command or script, or when you want to try out a package without installing it permanently.
npx create-react-app my-app
At this point, a basic understanding and working process should be achieved. Use this artical as a cheat sheet.
- Mirza Monirul Alam
- Full Stack Web Developer.
Any contributions will be appreciated. THANK YOU