NPM
NPM
Overview
npm init -y
The output would be:
{
"name": "<name-of-project>",
"version": "<version-of-project>",
"description": "",
"main": "<default-run-file>", // usually index.js
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Installing all dependencies : If a project has a package.json when we run:
npm install
{
......
......,
"dependencies": {
"express": "^4.18.2"
}
}
Flags that can be used with npm install command
--save : It installs the specified packages and adds them to the dependencies
section of the package.json file.
Command : npm install <package_name> --save
--save-dev : It installs the specified package and adds them to the devdependencies
section of the package.json file.
Command : npm install <package_name> --save-dev
npm update
uninstall <package_name>
Uninstall <package_name> -g
Popular NPM Packages
Express
React
Axios
Nodist
Benefits of NPM