What is Npm

gkumarpandey

Gautam kumar Pandey

Posted on August 5, 2022

What is Npm

Npm stands for Node package manager. npm is a package manager for the JavaScript programming language. it is default package manager for the JavaScript runtime environment Node.js
Npm consists of components
Command line client also called npm
Online database for public and paid for private packages
called npm registry

What can do with npm ?
npm allow us to new package from the registry. also it allow
us to discover and publish new node packages.

What is Package?
A package in Node.js contains all the files you need for a module. Moudles are JavaScript libraries you can include in your project.

Install new package
To install new package, you use the command npm install

npm install <package-name>
Enter fullscreen mode Exit fullscreen mode

How to Update Package
To update the package installed install locally in your nodejs project write the following command

npm update <package-name>
Enter fullscreen mode Exit fullscreen mode

What is package.json ?
Every project in JavaScript whether it is nodejs or a browser application can be scoped as an npm package with its own package information and its package.json job to describe the project.

we cna think of package.json as stamped labels on those npm good boxes that our army of wombats delivers around.

package.json will be generatied when npm npm init is run to initialise a javaScript/Node.js project, with these basic metadata provided by developers:
Example:

{
  "name": "my-app",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.3.0",
    "@testing-library/user-event": "^13.5.0",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-scripts": "5.0.1",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
Enter fullscreen mode Exit fullscreen mode

What is Dependencies
When you install an npm package using npm install <package-name>, you are installing it as a dependency. the package is automatically listed in the package.json file, under the dependiecies list

💖 💪 🙅 🚩
gkumarpandey
Gautam kumar Pandey

Posted on August 5, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related