Nodejs Study Notes < five >NPM use

Source: Internet
Author: User

NPM is a package management tool that is installed with Nodejs to resolve many issues with NODEJS code deployment.

Here are a few common usage scenarios:

    1. Allows users to download third-party packages written by others from the NPM server for local use.
    2. Allows users to download and install command-line programs written by others from the NPM server for local use.
    3. Allows users to upload their own packages or command-line programs to the NPM server for others to use.

NPM is installed in conjunction with node. js. So you can view the current NPM version number directly from the command line via the npm - v command.

NPM upgrades are available through NPM commands.

npm Install npm-g ( only for window environments )

NPM is primarily used to install a third-party package ( both module ) command:npm Install module Name.

Modules can be installed locally and can be installed to the Global. ( Install command installed to local by default )

// Local Installation // Global Installation

References to new modules after they are installed:

var new_module = require (' module_name ');

Error that may occur:

NPM err! Error:connect econnrefused 127.0.0.1:8087

Workaround:

NPM config set proxy null ( command Line input )

**************************************************************************************************************

Global Installation

    1. Place the installation package under/usr/local or your node's installation directory.
    2. Can be used directly on the command line.

Local Installation

    1. Place the installation package under./node_modules (the directory where the NPM command is running), and if there is no Node_modules directory, the Node_modules directory is generated under the directory where the NPM command is currently executing.
    2. Locally installed packages can be introduced via require ().

**************************************************************************************************************

Uninstalling the module

NPM Uninstall Module Name

Update module

NPM Update Module Name

Search Module

NPM Search Module Name

For more in-depth knowledge of NPM or the ability to create a module, click to enter

Nodejs Study Notes < five >NPM use

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.