前言

记一些Node&Npm使用记录

Node升级

以下命令,Linux可能需要权限

npm install -g n
n latest

如果windows下面报错,windows版本可以尝试下载官方的msi软件包覆盖安装,也是可行的

Npm升级

npm install -g npm

Npm更新

更新全局可更新的包

npm update -g

更新package.json可更新的包

npm update

检查npm包的状态

npm-check -u -g

查看哪些包有更新

npm -g outdated

全局安装

npm install -g

Nrm的使用

安装

npm install -g nrm

使用

显示registry可用列表

nrm ls

1
2
3
4
5
6
7
8
$ nrm ls

* npm ---- https://registry.npmjs.org/
cnpm --- http://r.cnpmjs.org/
eu ----- http://registry.npmjs.eu/
au ----- http://registry.npmjs.org.au/
sl ----- http://npm.strongloop.com/
nj ----- https://registry.nodejitsu.com/

使用registry

nrm use cnpm

1
2
3
$ nrm use cnpm 

>>> Registry has been set to: http://r.cnpmjs.org/

测试registry的延迟

nrm test

END.