January 4, 2021
Estimated Post Reading Time ~

NPM: Node.JS Package Manager

JavaScript is the most widely used language in Website and Web-Application development. There is an unlimited number of resources and libraries. Whilst developing, initially, the number of libraries are minimal and easy to manage, as the project progresses managing the libraries will be a tedious process. That's where NPM comes into the picture.

Node Package Manager or simply NPM is a package manager most widely used in conjunction with Node.JS and many other Javascript. NPM is used because it gives exceptional control over the dependencies in the project.

# Install a Package 
$ npm install 

# Install Specific version of a package 

$ npm install @version 
$ npm install abcd@1.2.3

COMMAND LINE OPTIONS:
Command-line is where we spend most of our time, and <strong>npm</strong> the command line is very powerful and the following are a few things about the npm command-line options. NPM documentation is the ultimate location to get end-to-end information about the command-line options. Following are the most widely used commands;

install:
This command will install a package and any package that depends on. Following are the options available


access:
This command will allow you to set access control on a private package, subcommands available are public, restricted, grant, revoke, ls-packages, ls-collaborators, and edit

bin:
This command will print out the location where npm will install executables


cache:
This command is Used to add, list, or clean the npm cache folder.


config:
npm gets its config settings from the command line, environment variables, npmrcfiles, and in some cases, the package.json file.

dedupe:
The deduplication algorithm walks the tree, moving each dependency as far up in the tree as possible, even if duplicates are not found. This will result in both a flat and deduplicated tree.

doctor:
npm doctor runs a set of checks to ensure that your npm installation has what it needs to manage your JavaScript packages. npm is mostly a standalone tool, but it does have some basic requirements that must be met:
  • Node.js and git must be executable by npm.
  • The primary npm registry, registry.npmjs.com, or another service that uses the registry API, is available.
  • The directories that npm uses, node_modules (both locally and globally), exist and can be written by the current user.
  • The npm cache exists, and the package tarballs within it aren’t corrupt.


By aem4beginner

No comments:

Post a Comment

If you have any doubts or questions, please let us know.