npm配置国内镜像源

编程教程 > WEB (1927) 2024-11-26 14:39:04

环境说明


下载的nodejs版本10.80
安装nodejs后自带的npm版本为6.2.0

npm环境说明
npm环境说明

 

npm配置文件简介

npm的配置文件为用户根目录下的:~/.npmrc(Windows路径为:C:\Users\<UserName>\.npmrc)

 

npm 源配置

配置国内npm镜像源

全局配置,配置后全默认生效使用该镜像

//设置源
npm config set registry https://npmreg.proxy.ustclug.org/
//缓存[推荐操作]
npm cache clean -f 
//避免 SSL 校验失败[推荐操作]
npm config set strict-ssl false
//移除代理配置[可选操作]
npm config delete proxy
npm config delete https-proxy

提示:如果配置后还有之前的镜像地址,删除配置文件.npmrc  再进行配置。

配置完成后查看配置,验证npm源配置命令

npm config get registry

或者

npm info express

 

临时安装某个插件使用配置(安装特殊依赖包时候适用):

npm --registry npm config set registry https://npmreg.proxy.ustclug.org/ install express


 

其他镜像:

 

2024 提示:淘宝https://registry.npm.taobao.org不太稳定了,需要使用新的 https://registry.npmmirror.com


 


评论
User Image
提示:请评论与当前内容相关的回复,广告、推广或无关内容将被删除。

相关文章
环境说明下载的nodejs版本10.80安装nodejs后自带的npm版本为6.2.0npm环境说明 npm配置文件简介npm的配置文件为用户根目录下的:~/.
清华openwrt软件源配置执行命令配置:sed -i 's_https\?://downloads.openwrt.org_https://mirrors.
Apine Linux 配置国内软件源echo "https://mirrors.tuna.tsinghua.edu.cn/alpine/v3.16/main" &gtl; /etc/apk/r...
PVE 7.x更换国内源备份之前的cp /etc/apt/sources.list.d/pve-install-repo.list /root删除企业源rm /etc/apt/sources.l...
问题ollama国内拉取模型慢,断点续传也蛮怎么办,当然是修改ollama镜像源 配置ollama模型国内镜像源
Ubuntu 20.04 更换国内apt源第一步:备份源文件:sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup第二步:编辑/e...
npm通过verdaccio搭建私服镜像库,以此提高本地多人协同install速度。verdaccio安装方式选为docker方式。docker相关知识可以查看
错误日志参考:npm ERR! code ERESOLVEnpm ERR! ERESOLVE unable to resolve dependency tree
1.备份已有的源#mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.
1.打开github nodejs源码地址GitHub - nodesource/distributions: NodeSource Node.js Binary Distributions2....
PVE软件源更换禁用pve企业源mv/etc/apt/sources.list.d/pve-enterprise.list/etc/apt/sources.list.d/pve-enterpri...
先安装nodejs然后全局安装pnpm工具npm install -g pnpm
centos6源码安装MySQL5.6
1.备份mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backu