What is npm?

What is npm?

What is npm?

on June 25th at 4:13am

The World's Largest Software Registry (Library)

npm is the world's largest Software Registry.

The registry contains over 800,000 code packages.

Open-source developers use npm to share software.

Many organizations also use npm to manage private development.


Using npm is Free

npm is free to use.

You can download all npm public software packages without any registration or logon.


Command Line Client

npm includes a CLI (Command Line Client) that can be used to download and install software:

Windows Example

C:\>npm install <package>

Mac OS Example

>npm install <package>


Installing npm

npm is installed with Node.js

This means that you have to install Node.js to get npm installed on your computer.

Download Node.js from the official Node.js web site: https://nodejs.org


Software Package Manager

The name npm (Node Package Manager) stems from when npm first was created as a package manager for Node.js.

All npm packages are defined in files called package.json.

The content of package.json must be written in JSON.

At least two fields must be present in the definition file: name and version.

Example

{
"name" : "foo",
"version" : "1.2.3",
"description" : "A package for fooing things",
"main" : "foo.js",
"keywords" : ["foo", "fool", "foolish"],
"author" : "John Doe",
"licence" : "ISC"
}


Managing Dependencies

npm can manage dependencies.

npm can (in one command line) install all the dependencies of a project.

Dependencies are also defined in package.json.


Sharing Your Software

If you want to share your own software in the npm registry, you can sign in at:

https://www.npmjs.com


Publishing a Package

You can publish any directory from your computer as long as the directory has a package.json file.

Check if npm is installed:

C:\>npm

Check if you are logged in:

C:\>npm whoami

If not, log in:

C:\>npm login
Username: <your username>
Password: <your password>

Navigate to your project and publish your project:

C:\Users\myuser>cd myproject
C:\Users\myuser\myproject>npm publish


Related posts

By Admin on July 11th at 8:03am

SSL (Secure Sockets Layer) is the standard security technology for establishing an encrypted link between a web server and a browser. This link ensures that all data passed between the web server and browsers remain private and integral. SSL is an industry standard and is used by millions of websites in the protection of their online transactions with their customers.

By Admin on June 25th at 4:18am

HTTP stands for Hyper Text Transfer Protocol.
WWW is about communication between web clients and servers.
Communication between client computers and web servers is done by sending HTTP Requests and receiving HTTP Responses.

PropellerAds

Blog categories