Node Package Manager (NPM) Commands

Posted on Posted in Cheat Sheets, Topics, Web Dev

Node Package Manager (NPM) is two things, repositories for Node.js packages/modules and a command line utility to install Node.js packages, do version management and dependency management of Node.js packages.

NPM is bundled with the Node.js installation.

The NPM online repositories can be accessed here.

NPM Commands

Test a successful installation:

or

 

Interactively create a package.json file:

 

Install package:

 

Install package globally:

or

 

Install package with a specific version (replace installed package with specified version):

 

Uninstall package:

 

View installed packages:

or

 

View globally installed packages:

or

 

View outdated packages in your project:

 

Update all obsolete packages in your project:

 

Update specific obsolete package in your project:

 

View package info:

 

View the latest version of a package:

 

View all versions of a package:

 

Start the Node server.js:

 

Install http-server module for web development

Use this command to start an HTTP server on your local machine in the current directory: http-server.

 

 

To be continued…

Spread the knowledge

Leave a Reply

Your email address will not be published. Required fields are marked *