Mean tutorial 3-NPM Installation

Source: Internet
Author: User
Tags install node

About NPM
Node is just a platform, and its functionality and API will be just a minimal set. To get more functionality, you can use the module
System to extend the platform. The best way to install, update, and delete a node. js module is to use the NPM tool. NPM has two of the following
Key Features:
? As a package registration center, for third-party module access, download and installation;
? Serves as a command line interface for managing packages that are global to a project or system.
Normally, when you install node. js, NPM is installed, and we'll just start using it.
NPM uses
NPM is a robust package manager that centrally registers open modules. You can access the official website by visiting
https://npmjs.org/Browse all available public packages.

NPM has two modes of installation: local and global. The general practice is to install the third-party package in local mode to
In the Node_modules folder under the app directory, this is the NPM default installation mode. It does not affect the overall system, but
Does not add some unnecessary global files and pollute the system.

The modules installed in the global mode can be used
For all node. JS applications in this system, the installation path in Unix-like systems is generally/usr/local/lib/node_modules,windows
The general is C:\Users\%USERNAME%\AppData\Roaming\npm\node_modules.

Using NPM to install packages
After you locate the installation package that you want to install, you can install it by using the following command:
$ npm Install <package Unique name>
The global installation mode is similar to the local installation mode and requires only one-G parameter:
$ npm install-g <package Unique name>
If the current user does not have permission to install the global mode, install it using the root user or sudo
Can.
For example, we want to install express locally, first into the directory where the application is located, and then execute the following command:
$ NPM Install Express
The above command installs the latest stable version of Express in the local node_modules directory. In addition, NPM supports a variety of
The version number of the semantics that is installed when a specified version is installed by running the NPM command as follows:
$ npm Install <package Unique name>@<package version>
For example, to install the second large version of Express, you can use the following command:
$ NPM Install [email protected]
This will install the latest stable version of Express 2. The above command format supports NPM to download and install any minor of Express 2
Version. To learn more about the supported semantic version syntax, visit https://github.com/isaacs/node-semver.

If the package that needs to be installed has a dependent package, NPM automatically installs the package it depends on and creates it within the package's folder
Node_modules, used to store dependent packages. In the example above, Express's dependency package will be installed into the node_modules/
The Express/node_modules.

Mean tutorial 3-NPM Installation

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.