What is npm and How it works?
19 September, 2022
17
17
0
Contributors
npm - Node Package Manager
How to install npm
1.
2.
3.
4.
npm -v
in your favourite terminal.npm benefits
•
•
initialize npm
1.
2.
npm init
to create new package.3.
4.
npm init --yes
.5.
install package
•
npm install package_name --save
. It install package locally in that repo.•
npm install package_name -g
.•
--save
saves the dependency **version **in package.json file.•
npm install package_name --save-dev
it will save package as devDependency•
npm uninstall package_name --save
.•
Version System
•
Major Version → It is version which conatin new features than previous version and also it can break the project if use in uncompatible type.
•
Minor Version → This version contains minor updates and features and it can't break the project.
•
Patch → Patch is just some bug fixes and it doesn't break anything.
npm update
npm update package_name
command is use.
There are 4 parameters or flags that denote whole version system and updates which contains in dependencies section in package.json file.•
•
•
npm install package_name@versionNumber
.•
Concepts use in this blog
Dependency
devDependency
package.json file
•
•
•