table of Contents:
1: NPM
2:CNPM
3: NRM
4:homebrew
5: specific instructions
6: -g -S -D
1: NPM
NPM stands Node Package Manager,
NodeJS is a package management and distribution tools.
2: NRM
nrm (npm registry manager) is a mirror image of npm source management tool, sometimes foreign resources too slow, you can use this to quickly switch between the source npm
registry: Registry; Registry; source address,
3: cnpm
Taobao mirror, every 10 minutes.
4: Homebrew referred to as BREW ,
Homebrew is the package management tool under Mac OS platform, it is easy to help us install, uninstall, update, view, search, and many other useful features. A simple instruction, the package management can be achieved, the Homebrew official website clearly describes the installation and use of basic
5: Details
5.1: asl
- NPM allows users to download from the server written by someone else third-party packages to local use.
- It allows users to download and install the command-line program written by someone else to use local NPM from the server.
- It allows users to write their own bag or command line program uploaded to the server for others to use NPM
5.2: npm command
npm -v
To test whether the successful installation- View the current directory of installed plug-ins:
npm list
- Update All plug-ins:
npm update [ --save-dev ]
- Use npm updates the corresponding plug-in:
npm update <name> [ -g ] [ --save-dev]
- Use npm uninstall the plug:
npm uninstall <name> [ -g ] [ --save-dev ]
5.3:cnpm
- Taobao national team to do a mirror, because npm servers located abroad may affect the installation. Taobao official synchronous mirroring and frequency of the current 10 minutes to ensure as far as possible synchronized with the official service.
- Installation: Execute the command prompt
npm install cnpm -g --registry=https://registry.npm.taobao.org
cnpm -v
To test whether the successful installation
By changing the address to use Taobao mirror
- The default address is npm
https://registry.npmjs.org/
- It can be used
npm config get registry
to view npm warehouse address - Can be used
npm config set registry https://registry.npm.taobao.org
to change the default download address, you can not reach the installationcnpm
will be able to adopt the purpose of Taobao mirror, then use the above command to see if get success.
5.4: NRM
nrm
Package installation command:npm i nrm -g
nrm
Be able to manage with the available mirror mirror source address and source address currently used, but simply provides several url and allows us to easily switch between these addressesnrm ls
That nrm list, all available view mirror, and can be switched. * Number indicates the address of the currently used npm, you can use the commandnrm use taobao
ornrm use npm
to switch between them.
6: -g -S -D
-g
: Global installation. Will be installed in C: \ Users \ Administrator \ AppData \ Roaming \ npm, and write system environment variables; non-global installation: positioning will be installed in the current directory; global installed through the command line anywhere to call it, will be installed locally node_modules locate files are installed in the directory folder, by requiring a call;-S
: That isnpm install module_name --save
, writepackage.json
independencies
,dependencies
is the need to publish to a production environment, such jq, vue family bucket, ele-ui ui framework, etc. These items must be used to run when you need to put the plugdependencies
-D
: That isnpm install module_name --save-dev
, writepackage.json
indevDependencies
,devDependencies
which is used only for plug-in development environment, not for production environments. For example, some plug-babel compiled function, webpack packaged plug-ins that need time to develop, some plug-ins to run real packaged up and do not need.
Why do you want to save
package.json
as node_module package is too great. With a configuration file is saved, only the plug-in installation package corresponding to the configuration file, import demand