NPM's use with NPM's team building

Source: Internet
Author: User

First, NPM Introduction:

NPM, called node Package Manager, is a node. JS-based pack manager and the most popular and supported third-party module in the entire node. JS community.

Usage Scenarios for NPM:

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

NPM version query: npm-v

NPM Installation:

1, installation Nodejs

Because NPM is already integrated with the new Nodejs, you can test for a successful installation by entering Npm-v directly.

2. Use NPM command to upgrade NPM:NPM install Npm-g

Second, the use of NPM

    • Package Management:
      • To install a module (package) using NPM:

      

Local Install command: NPM install <package name> Example: NPM Install Express

Global Install Command: NPM install <package name> Example: NPM install Express-g

Local Installation Method:

      1. Place the installation package under./node_module (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 ().

Global Installation Method:

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

If you want to have both features, you'll need to install it in two places or use NPM link.

Next we use the global way to install EXPRESS:NPM install Express-g

      

View all globally installed modules: NPM is-g

If the following error occurs:

NPM err! Error:connect econnrefused 127.0.0.1:8087

The workaround is: NPM config set proxy null

      • Update package:

Local: NPM update <package name> For example: NPM Update Express

View update package commands: NPM outdated

Global: NPM install-g <package> For example: NPM Install-g Express

Update all packages: NPM update-g

Find update packages: NPM outdated-g--depth=0

      • To uninstall a package:

Local: NPM Uninstall <package> For example:npm Uninstall Express

After uninstalling, you can check to see if the package still exists in the/node_modules/directory, or use the following command to view:

NPM is// NPM Uninstall--save Express

Global: NPM uninstall-g <package> For example: NPM Uninstall-g Express

      • The release of the package:

      

      • Version control for NPM

To modify NPM permissions:

Ls-l View global permissions.

You may receive a global error if you try to install a global package for storage and use related commands without NPM permissions EACCES .

You can use one of the following two options: solve this problem

    1. Change the default directory for license NPM.
    2. The default directory for NPM changes to another directory.

  You should be ready to back up your computer before.

1. Modify the default directory of the license NPM.

To create a module:

Retrieving modules:

The configuration of NPM:

Iii. How NPM works:

Iv. NPM Team Building:

V. Using CLI commands:

Vi. Programming with NPM:

NPM's use with NPM's team building

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.