npm常用指令,npm 下载有问题?

1.查看当前地址:
npm config get registry 
 
2.设置当前地址(设置为淘宝镜像)

注意:原来的 https://registry.npm.taobao.org 已替换为 https://registry.npmmirror.com ,

因为2024年1 月 22 日,淘宝原镜像域名(registry.npm.taobao.org)的 HTTPS 证书正式到期并更换为更为低调符合国家法律规定的镜像服务,这是一个完整 npmjs.org 镜像,你可以用此代替官方版本(只读),同步频率目前为 10分钟 一次以保证尽量与官方服务同步


npm config set registry   https://registry.npmmirror.com 


3.设置当前地址(设置为默认官方npm地址)
npm config set registry https://registry.npmjs.org/
 
4.每次执行命令前加入–registry指定仓库路径
npm --registry https://registry.npm.taobao.org install


5.查看所有全局安装的依赖包:

npm list -g

6.更新模块

npm update express(要更新的依赖名)

7.使用cnpm

你可以使用淘宝定制的 cnpm (gzip 压缩支持) 命令行工具代替默认的 npm:

npm install -g cnpm --registry=https://registry.npmmirror.com

你可能感兴趣的:(npm)