NPM加速配置

NPM加速

yarn

命令行

yarn config set "sass_binary_site" "http://cdn.npm.taobao.org/dist/node-sass"
yarn config set "@xxxxx:registry" "https://registry-npm.xxxxx.com"
yarn config set "registry" "https://registry.npm.taobao.org/"

.yarnrc

"registry" "https://registry.npm.taobao.org/"
"@xxxxx:registry" "https://registry-npm.xxxxx.com"
"sass_binary_site" "http://cdn.npm.taobao.org/dist/node-sass"

npm

命令行

npm config set "sass_binary_site" "http://cdn.npm.taobao.org/dist/node-sass"
npm config set "@xxxxx:registry" "https://registry-npm.xxxxx.com"
npm config set "registry" "https://registry.npm.taobao.org/"

.npmrc

"registry"="https://registry.npm.taobao.org/"
"sass_binary_site"="http://cdn.npm.taobao.org/dist/node-sass"
"@xxxxx:registry"="https://registry-npm.xxxxx.com"

查看配置

npm config list

; "user" config from /Users/shang/.npmrc

//registry.npmjs.com/:_authToken = (protected)
electron_mirror = "https://npm.taobao.org/mirrors/electron/"
profiler_binary_host_mirror = "https://npm.taobao.org/mirrors/node-inspector/"
; registry = "https://registry.npm.taobao.org/" ; overridden by project
sass_binary_site = "https://npm.taobao.org/mirrors/node-sass/phantomjs_cdn"
sqlite3_binary_host_mirror = "https://foxgis.oss-cn-shanghai.aliyuncs.com/"
url = "http://cnpmjs.org/downloads"

; "project" config from /Users/shang/Code/kmos/kmos/.npmrc

@xxxxxx:registry = "https://registry-npm.xxxxxx.com"
registry = "https://registry.npm.taobao.org/"

; node bin location = /usr/local/bin/node
; cwd = /Users/shang/Code/kmos/kmos
; HOME = /Users/shang
; Run `npm config ls -l` to show all defaults.

yarn config list

yarn config v1.22.17
info yarn config
{
  'version-tag-prefix': 'v',
  'version-git-tag': true,
  'version-commit-hooks': true,
  'version-git-sign': false,
  'version-git-message': 'v%s',
  'init-version': '1.0.0',
  'init-license': 'MIT',
  'save-prefix': '^',
  'bin-links': true,
  'ignore-scripts': false,
  'ignore-optional': false,
  registry: 'https://registry.npm.taobao.org/',
  'strict-ssl': true,
  'user-agent': 'yarn/1.22.17 npm/? node/v16.13.1 darwin x64',
  '@base:registry': 'https://registry-npm.xxxxxx.com',
  '@xxxxxx:registry': 'https://registry-npm.xxxxxx.com',
  lastUpdateCheck: 1644378532337,
  sass_binary_site: 'http://cdn.npm.taobao.org/dist/node-sass',
  'omit.js': 'https://registry.npmjs.org/omit.js',
  '@ant-design:registry': 'https://registry.npm.taobao.org'
}
info npm config
{
  registry: 'https://registry.npm.taobao.org',
  sass_binary_site: 'https://npm.taobao.org/mirrors/node-sass/phantomjs_cdn',
  url: 'http://cnpmjs.org/downloads',
  electron_mirror: 'https://npm.taobao.org/mirrors/electron/',
  sqlite3_binary_host_mirror: 'https://foxgis.oss-cn-shanghai.aliyuncs.com/',
  profiler_binary_host_mirror: 'https://npm.taobao.org/mirrors/node-inspector/',
  '//registry.npmjs.com/:_authToken': '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',
  '@xxxxxx:registry': 'https://registry-npm.xxxxxx.com'
}
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
Node.js 是一个基于 Chrome V8 引擎的 JavaScript 运行环境。npmNode.js 的包管理器,用于下载和安装第三方模块。以下是 Node.jsnpm 的安装配置步骤: 1. 下载 Node.js 安装包:从官网 https://nodejs.org/en/ 下载适合自己系统的安装包,选择 LTS 版本即可。 2. 安装 Node.js:双击下载的安装包,按照提示一步步安装即可。 3. 验证 Node.js 是否安装成功:在命令行中输入 node -v,如果出现版本号则说明安装成功。 4. 配置 npmNode.js 安装完成后,npm 已经自动安装在本地,可以在命令行中输入 npm -v 验证是否安装成功。 5. 切换 npm 源为淘宝镜像:npm 安装包默认使用的是国外的源,下载速度较慢。可以使用淘宝镜像加速 npm 的下载。在命令行中输入 npm config set registry https://registry.npm.taobao.org/ 即可。 6. 配置全局安装目录:npm 默认的全局安装目录是 /usr/local/lib/node_modules,但是这个目录需要 root 权限才能访问。可以将全局安装目录切换到自己的 home 目录下,比如 ~/.npm-global。在命令行中输入 npm config set prefix '~/.npm-global',然后将路径添加到 PATH 环境变量中,即可使用全局安装的模块。 7. 验证全局安装目录是否生效:在命令行中输入 npm config get prefix,如果输出的路径为 ~/.npm-global,则说明全局安装目录已经生效。 以上是 Node.jsnpm 的安装配置步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

从未、淡定

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值