更改npm为国内镜像

在终端执行.

npm set registry http://registry.npmmirror.com

首先, 打开"我的电脑". 找到"c盘中用户文件夹". 找到你当前正在使用的"用户"

代码如下.

registry=http://registry.npmmirror.com/

disturl=https://registry.npmmirror.com/-/binary/node/
# node-sass预编译二进制文件下载地址
sass_binary_site=https://registry.npmmirror.com/-/binary/node-sass
# sharp预编译共享库, 截止2022-09-20 sharp@0.31.0的预编译共享库并未同步到镜像, 入安装失败可切换到sharp@0.30.7使用
sharp_libvips_binary_host=https://registry.npmmirror.com/-/binary/sharp-libvips
python_mirror=https://registry.npmmirror.com/-/binary/python/
electron_mirror=https://registry.npmmirror.com/-/binary/electron/
electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/
# 无特殊配置参考{pkg-name}_binary_host_mirror={mirror}
canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas
node_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/sqlite3
better_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/better-sqlite3

MAC同学,

​ 如果是M1芯片的. 需要先更新一些库. 不是M1的不用管

​ 包括但不限于:

brew install pkg-config cairo pango libpng jpeg giflib librsvg

  1. 命令行方式:

    npm config set registry http://registry.npmmirror.com
  2. 编辑 ~/.npmrc 文件, 设置方案和windows的一样

registry=http://registry.npmmirror.com/

disturl=https://registry.npmmirror.com/-/binary/node/
# node-sass预编译二进制文件下载地址
sass_binary_site=https://registry.npmmirror.com/-/binary/node-sass
# sharp预编译共享库, 截止2022-09-20 sharp@0.31.0的预编译共享库并未同步到镜像, 入安装失败可切换到sharp@0.30.7使用
sharp_libvips_binary_host=https://registry.npmmirror.com/-/binary/sharp-libvips
python_mirror=https://registry.npmmirror.com/-/binary/python/
electron_mirror=https://registry.npmmirror.com/-/binary/electron/
electron_builder_binaries_mirror=https://registry.npmmirror.com/-/binary/electron-builder-binaries/
# 无特殊配置参考{pkg-name}_binary_host_mirror={mirror}
canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas
node_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/sqlite3
better_sqlite3_binary_host_mirror=https://registry.npmmirror.com/-/binary/better-sqlite3

附赠:

​ npm官方库搜索: https://www.npmjs.com/

​ JS语法规则:https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference

​ rsa.js很古老的一个库 https://ohdave.com/rsa/

5 更换npm为国内镜像的更多相关文章

  1. 更换 npm 源国内镜像 cnpm

    默认镜像源 https://www.npmjs.com/ 临时改变镜像源 方法一:通过config配置指向国内镜像源 npm config set registry http://registry.c ...

  2. npm配置国内镜像资源+淘宝镜像

    将npm的注册表源设置为国内的镜像 1.国内用户,建议将npm的注册表源设置为国内的镜像,可以大幅提升安装速度 2.国内优秀npm镜像推荐及使用:http://riny.net/2014/cnpm/ ...

  3. npm 使用国内镜像的方法

    npm全称Node Package Manager,是node.js的模块依赖管理工具.由于npm的源在国外,所以国内用户使用起来各种不方便.我们通过设置使用淘宝的镜像来加快我们的速度. 临时使用 n ...

  4. npm使用国内镜像的方法

    一.通过命令配置1. 命令 npm config set registry https://registry.npm.taobao.org 2. 验证命令 npm config get registr ...

  5. 修改apt,pip,npm为国内镜像源

    apt 原文件备份 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 编辑源列表文件 sudo vim /etc/apt/sources. ...

  6. 使用nvm管理node.js版本以及更换npm淘宝镜像源

    目录 1,前言 2,安装nvm 3,nvm的使用 4,错误处理 5,修改npm默认镜像源 6,win10下cnpm报错 1,前言 注意:此教程仅限Windows,Mac可能不适用 在我们的日常开发中可 ...

  7. Node.js NPM国内镜像

    NPM国内镜像 http://npm.hacknodejs.com/ http://registry.npmjs.vitecho.com/ https://registry.npm.taobao.or ...

  8. npm 国内镜像资源 --转载

    npm 是node.js 环境下的包管理器,非常强大智能. 生活这这片神奇的土地上,各种奇葩手段屡见不鲜啊. 为什么要换源? npm 官方站点 http://www.npmjs.org/ 并没有被墙, ...

  9. 给电脑换源 npm 国内镜像 cnpm

    (1)通过 config 配置指向国内镜像源 npm config set registry http://registry.cnpmjs.org //配置指向源 npm info express   ...

  10. pip 更换国内镜像与记录

    更换pip源到国内镜像 阿里云 http://mirrors.aliyun.com/pypi/simple/   中国科技大学 https://pypi.mirrors.ustc.edu.cn/sim ...

随机推荐

  1. django中update_or_create()

    update_or_create()方法中有一个defaults参数 模型字段会根据查询条件进行查询,如果查询到了,那么就用defaults对应的值去更新字段,如果没有查到就用defaults对应的值 ...

  2. 【LeetCode字符串#04】左旋转字符串,以及反转函数使用说明

    左旋转字符串 力扣题目链接(opens new window) 字符串的左旋转操作是把字符串前面的若干个字符转移到字符串的尾部.请定义一个函数实现字符串左旋转操作的功能.比如,输入字符串"a ...

  3. 玩转Vue3之Composables

    前言 Composables 称之为可组合项,熟悉 react 的同学喜欢称之为 hooks ,由于可组合项的存在,Vue3 中的组件之间共享状态比以往任何时候都更容易.这种新范例引入了一种更有组织性 ...

  4. springMvc精简整理

    精简共分步 新建一个web工程  导入核心就二包,因为springmvc 包自己有依赖 <?xml version="1.0" encoding="UTF-8&qu ...

  5. iview 多弹框,显示z-index 不对,被遮挡的解决方案 goTop函数 modal Drawer 抽屉

    iview 多弹框,显示z-index 不对,被遮挡的解决方案 goTop函数 modal 原因 弹多个modal框的时候,会被遮挡,导致后显示的框在下面 解决原理 获取当前弹框的z-index,然后 ...

  6. snipaste 替换 微信截图快捷键 F3贴图功能实在是太帅了 - 软件推荐

    snipaste 替换 微信截图快捷键 这个软件很久之前就知道,一直也没觉得可以替换微信的截图功能,毕竟能懒就懒. 今天同事又推荐 用了下,觉得确实ok. https://zh.snipaste.co ...

  7. WPF之命令

    目录 命令系统的基本元素 基本元素之间的关系 小试命令 WPF的命令库 命令参数 命令与Binding的结合 近观命令 ICommand接口与RoutedCommand 自定义Command 定义命令 ...

  8. PBKDF2算法:保障密码安全的利器

    PBKDF2算法起源: PBKDF2(Password-Based Key Derivation Function 2)算法是一种基于密码的密钥派生函数,最初由RSA实验室的密码学家提出,用于从密码中 ...

  9. day01-1-需求分析和项目设计

    满汉楼01 1.需求分析 满汉楼项目说明 因为javaGUI不是学习的重点,这里将继续使用控制台界面来代替界面和事件处理 完成的功能: 登录 订座 点餐 结账 查看账单等功能 在实际项目中,独立完成项 ...

  10. 百度api经历

    底部参考文档,欢迎点击:https://www.runoob.com/http/http-content-type.html 这两天遇到了点糟心事,因为小伙伴走了.然后事情起因是这样的,来了个任务封装 ...