node.js study notes (five) NPM

Npm (Node Package Manager): Node package (module) management tools, with the NPM, to help users quickly install and manage dependencies, so that we can easily use the package from the global Node developers to offer.

NPM commonly used in the following scenarios:

1. Allow users to download from the server written by someone else NPM third-party packages to local use.

2. Allow users to download and install command program written by someone else from using npm to the local server.

3. allows users to write their own bag or command program uploaded to the server for others to use NPM.

Detecting whether to install npm management tool, cmd, enter: npm -v; that is, the version number appears successful installation

A, NPM frequently used instructions

Use Taobao NPM Mirror: npm install -g cnpm --registry = https: //registry.npm.taobao.org details see: http: //npm.taobao.org/. 

Two, package.json 

package.json located in the directory module, defines the properties of the package.

package.json generated by the command: npm init -y

package.json Property Description:

  • name  - the package name.

  • Version  - the version number of the package.

  • Description  - description of the package.

  • homepage  official website url package -.

  • author  author names package -.

  • contributors  Other contributors to the name of the package -.

  • the Dependencies  - Dependencies list. If dependencies are not installed, the package will depend on NPM automatically installed in node_module directory.

  • Repository  - type package code stored in place, or may be the svn git, the git on a Github.

  • main  - main field specifies the master file entry procedures, require ( 'moduleName') will load the document. The default value of this field is the root directory module index.js.

  • keywords  - Keyword

 

Guess you like

Origin www.cnblogs.com/smile-xin/p/11618862.html