咸鱼

咸鱼是以盐腌渍后,晒干的鱼

0%

npm淘宝源

国内的源

ROOT账号问题

可能是由于安全问题,在root账号下操作一些安装经常出问题,加上以下参数:

1
npm i npm@latest -g --unsafe-perm=true --allow-root

CNPM

cnpm注册为使用国内淘宝的源,不影响国外源npm的使用

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

cnpm install 安装依赖库会有些小问题,详细请看 《用cnpm安装软件库的一个问题》

修改npm的配置

如果不想用cnpm而引起上述问题,可以按以下配置。

1
2
3
4
5
$ npm config set registry https://registry.npm.taobao.org

//验证配置
$ npm config get registry
https://registry.npm.taobao.org/

删除cnpm

这时候,你可以删除cnpm了

1
2
$ npm uninstall -g cnpm
removed 629 packages in 12.705s

还原官方源

1
$ npm config set registry https://registry.npmjs.org

查看当前源

1
$ npm config get registry