更改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. win32改变静态控件的文本大小

    HWND static_ = CreateWindow(L"STATIC", NULL, WS_CHILD | WS_VISIBLE | SS_LEFT, 100, 100, 10 ...

  2. mybatis处理集合、数组参数使用in查询

    对于mybatis的参数类型是集合数组的时候进行查询. 第一种:参数list ,使用mybatis的标签 1 SELECT * FROM TABLE_NAME AS a WHERE 2 3 a.id ...

  3. HttpURLConnection使用分析

    在项目中遇到各种版本的httpClient,所以想了解一下httpClient的实现 首先查看的是JDK1.1中自带的HttpURLConnection,看一下最初的设计是怎么样的 代码分析 使用Ht ...

  4. 项目实战:Qt数据分析处理平台(兼容各国产麒麟系统)(文件域字符串解析,上万文件批量导入,折线图、散点图,正态分布图分析处理导出等)

    若该文为原创文章,转载请注明原文出处本文章博客地址:https://blog.csdn.net/qq21497936/article/details/114710650长期持续带来更多项目与技术分享, ...

  5. 正则函数及面向对象开发初识---day19

    1.正则函数 # ### 正则函数 import re #search 通过正则匹配出第一个对象返回,通过group取出对象中的值 strvar = "1+2 3*4" obj = ...

  6. 协程与yield表达式

    在函数内,yield语句可以作为表达式使用,出现在赋值运算符的右边,例如: def receiver(): print("Ready to receive") while True ...

  7. python字符串模板文本处理之Template

    from string import Template s = Template('$who 在 $do') ts = s.substitute(who="张三", do=&quo ...

  8. pyqt5中通过pycharm配置designer(win和mac都适用,修改下designer目录路径即可)

    安装 pip install PyQt5 -i https://pypi.douban.com/simple pip install PyQt5-tools -i https://pypi.douba ...

  9. NodeJS开启GZIP功能

    gzip是用于压缩,效果特别好,js.css等文件的压缩率一般高达70% 具体方法如下: 先安装一个依赖 npm install compression --save 然后在已有代码里(一般是app. ...

  10. 【Azure 事件中心】Event Hub 消费端出现 Timeout Exception,errorContext中 LINK_CREDIT为0的解释

    问题描述 在使用Event Hub SDK消费数据过程中,出现大量的Timeout Exception,详细消息为: com.microsoft.azure.eventhubs.TimeoutExce ...