npm npm and cnpm and management tools

About npm source settings

1, using a temporary installation source address:

If you want to install a first use of a source command as follows:

	// 使用源镜像
	npm --registry https://registry.npm.org install
	// 使用淘宝镜像
	npm --registry https://registry.npm.taobao.org install

These two commands install followed by the installation package name specifies the installation package; not specified according package.json install

2, long-lasting source address:

If you want to have a source address using a command as follows:

	npm config set registry https://registry.npm.taobao.org

After the configuration can be verified by successful in the following manner

	// 如果成功则返回的是 上一步设置好的源地址;
	// npm config get registry 返回的是当前源地址;
	npm config get registry
	// npm info <name> 返回的是当前安装包的信息;
	npm info <安装包name>

Then you can use normal as usual npm command

3, by using Ali's image cnpm use

Mirroring cnpm Ali execution command:

	npm install -g cnpm --registry=https://registry.npm.taobao.org

Just need to execute the above command you can use the same as using npm cnmp, the only difference is that all commands are replaced npm CNPM ;
for example:

	cnpm install

4, through the use of nrm npm to manage the source address:

4-1, install
install nrm command:

	npm install -g nrm

Use After a successful installation nvm -V see if the installation was successful,
in case of an error , please view the solution

4-2, view the current list of sources
execute the command

	nrm ls

Shown below you can see the list on the left is the name of the right address. * With the current configuration:
Source List
replace nrm use <registry> registry command: representatives source;
Example:

	nrm use npm/yarn/cnpm/taobao

The use npm npm config list command to see view the current source configuration.

	npm config list 

Here Insert Picture Description
nrm also provides speed function, command nrm the Test [Registry] , does not know which source is selected, you can measure wave, which is faster to use which. When no registry, all measurable

	nrm test

The results are as follows
Here Insert Picture Description

Command Prompt:

  1. -V NRM : nvm view the current version.
  2. -h NRM : Display all commands.
  3. Current NRM : Displays the current source name.
  4. use NRM <Registry> : handover source.
  5. the Add NRM <Registry> <URL> [Home] : Adding a source. For example, the company's own private sources.
  6. the auth SET-NRM <Registry> <value> [Always] : set a custom authorization information source.
  7. In Email SET-NRM <Registry> <value> : Custom source to set the path.
  8. Hosted the repo-SET-NRM <Registry> <value> : Set to publish the custom source npm hosted storage.
  9. del NRM <Registry> : delete a custom source.
  10. Home NRM <Registry> [Browser] : open source browser home page.
  11. publish NRM [Options] [<tarball> | <Folder>] : release package to a custom source, if no custom source, then publish directly to npm.
  12. Test NRM [Registry] : access speed test resources. When no registry, test all.
Published 58 original articles · won praise 20 · views 110 000 +

Guess you like

Origin blog.csdn.net/fly_wugui/article/details/104748192