更改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. .NET Core 集成微信支付签名错误

    .NET Core 集成微信支付签名错误 The provided data is tagged with 'Universal' class value '16', but it should ha ...

  2. Gitlab中的打包作业完成后,更新http服务器里的版本号文件

    背景 在.gitlab-ci.yml里面,我们有4个场景 dotnet build.dotnet pack和dotnet push 单元测试 SSH到http服务器,更新对应的版本号文件里面的版本数字 ...

  3. 【Azure Redis 缓存】Azure Redis 遇见的连接不上问题和数据丢失的情况解答

    问题描述 PHP应用再连接Azure Redis服务时,出现Connection Timed out.当通过升级提高Azure Redis的性能时候,发现之前的数据丢失了. 问题解答 当Redis服务 ...

  4. 【Azure 服务总线】Azure门户获取ARM模板,修改Service Bus的TLS版本

    问题描述 在Azure中创建Sverice Bus服务后,如果想修改服务的TLS版本,是否有办法呢? 问题解答 通过Service Bus的ARM模板,修改属性值中的 minimumTlsVersio ...

  5. 【Azure 环境】当在Azure 环境中调用外部接口不通时,如何定位SSL Certificate Problem

    问题描述 如果在Azure VM中,发现同一个API,一台VM可以访问成功,另外一台访问失败.如何来调试并定位问题呢? 问题分析 第一步,查看访问外部API不通时候出现什么错误.如果没有明确的错误消息 ...

  6. 第12章_MySQL数据类型

    目录: https://www.cnblogs.com/xjwhaha/p/15844178.html 1. MySQL中的数据类型 类型 类型举例 整数类型 TINYINT.SMALLINT.MED ...

  7. Java 内部类 注意点

    1 package com.bytezreo.innerclass2; 2 3 /** 4 * 5 * @Description 内部类 注意点 6 * @author Bytezero·zhengl ...

  8. Codeforces Round 914 (Div. 2)A~C

    A 反过来考虑,由皇后和国王的位置去寻找骑士的位置,当一个点既可以被皇后找到,也可以被国王找到时就说明这个点是满足条件的 #include <bits/stdc++.h> #define ...

  9. [学习笔记]在CentOS7中用Docker方式安装Jenkins

    @ 目录 原理: 创建Docker网桥网络 安装DinD 创建镜像 构建镜像 运行容器 原理: Docker in Docker (以下简称 DinD)可以在 Container 中直接运行一个 Do ...

  10. koa 文件下载 pdf预览 两个接口 - nodejs - chromeDownload chromePreview

    koa 文件下载 pdf预览 两个接口 - nodejs - chromeDownload chromePreview chrome.js const router = require("k ...