nodejs设置镜像

1、npm镜像地址配置

javascript 复制代码
-- 查看 npm 安装目录
npm root -g
 
-- 查看 npm 配置信息
npm config list

-- 查询当前镜像配置
npm get registry

-- 或者仅修改 npm 命令镜像
-- 设置为淘宝镜像
npm config set registry https://registry.npmmirror.com
-- 修改为官方镜像
npm config set registry https://registry.npmjs.org/


-- 查看、更改缓存及全局安装地址
-- 1、查看npm的prefix和cache路径配置信息
npm config get cache
npm config get prefix
-- 2、设置路径(路径包含空格必须引号)
npm config set prefix "C:\Users\happy\AppData\Roaming\nodejs\node_data\npm_global"
npm config set cache "C:\Users\happy\AppData\Roaming\nodejs\node_data\npm_cache"

-- 使用npm命令安装的全局插件会保存在prefix目录中,需要将此加入系统环境变量才可以执行已安装插件命令

2、yarn 安装

javascript 复制代码
-- yarn (安装速度快,并行下载,缓存机制,本地缓存,可以断网使用)
npm install yarn -g
 
 -- 查询镜像配置
yarn config get registry
-- 设置淘宝镜像
yarn config set registry https://registry.npmmirror.com
-- 设置为官方镜像
yarn config set registry https://registry.yarnpkg.com
 
-- 或者可以安装淘宝定制命令 tyarn
cnpm i yarn tyarn -g
-- 安装检查
tyarn -v
 
-- 查看、修改 yarn 安装及缓存位置
-- 1、全局安装及缓存位置
yarn config get prefix
yarn config get cache
-- 2、修改全局安装及缓存位置
yarn config set global-folder "C:\Users\happy\AppData\Roaming\nodejs\node_data\yarn_global"
yarn config set cache-folder "C:\Users\happy\AppData\Roaming\nodejs\node_data\yarn_cache"
 
-- 使用yarn命令安装的全局插件会保存在prefix目录中,需要将此加入系统环境变量才可以执行已安装插件命令
 
-- 代理设置
-- 同 NPM
相关推荐
outsider_友人A26 分钟前
前端也想写后端(3)中间件Middleware、管道Pipes、拦截器Interceptors
前端·node.js·nestjs
爱加班的猫20 小时前
Node.js 中 require 函数的原理深度解析
前端·node.js
冲!!1 天前
使用nvm查看/安装node版本
前端·node.js·node·nvm
萌萌哒草头将军2 天前
Node.js v24.6.0 新功能速览 🚀🚀🚀
前端·javascript·node.js
行星0082 天前
mac 通过homebrew 安装和使用nvm
macos·npm·node.js
kngines2 天前
【Node.js从 0 到 1:入门实战与项目驱动】1.3 Node.js 的应用场景(附案例与代码实现)
node.js
xrkhy3 天前
nvm安装详细教程(卸载旧的nodejs,安装nvm、node、npm、cnpm、yarn及环境变量配置)
前端·npm·node.js
专注API从业者3 天前
Python/Node.js 调用taobao API:构建实时商品详情数据采集服务
大数据·前端·数据库·node.js
Q_Q19632884753 天前
python基于Hadoop的超市数据分析系统
开发语言·hadoop·spring boot·python·django·flask·node.js
布兰妮甜3 天前
Vite 为什么比 Webpack 快?原理深度分析
前端·webpack·node.js·vite