You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Vue3 CLI 持续弹出网络缓慢提示,如何禁用该交互?

解决Vue CLI自动安装时的registry提示问题

在E2E测试流程中,使用Vue CLI自动安装Vue3的命令如下:

npx --yes @vue/cli create vue3 --packageManager npm -n -i '{"useConfigFiles":true,"plugins":{"@vue/cli-plugin-babel":{},"@vue/cli-plugin-typescript":{"classComponent":false,"useTsWithBabel":true},"@vue/cli-plugin-pwa":{},"@vue/cli-plugin-router":{"historyMode":true},"@vue/cli-plugin-vuex":{},"@vue/cli-plugin-eslint":{"config":"prettier","lintOn":["save"]}},"vueVersion":"3"}'

安装过程中反复出现以下交互式提示,导致构建因等待输入失败:

? Your connection to the default yarn registry seems to be slow.
Use https://registry.npmmirror.com for faster installation? (Y/n)

以下是几种禁用该提示的方法:

  • 使用环境变量跳过检查
    在执行Vue CLI命令前添加VUE_CLI_SKIP_REGISTRY_CHECK=true环境变量,直接跳过镜像源速度检查,修改后的命令为:

    VUE_CLI_SKIP_REGISTRY_CHECK=true npx --yes @vue/cli create vue3 --packageManager npm -n -i '{"useConfigFiles":true,"plugins":{"@vue/cli-plugin-babel":{},"@vue/cli-plugin-typescript":{"classComponent":false,"useTsWithBabel":true},"@vue/cli-plugin-pwa":{},"@vue/cli-plugin-router":{"historyMode":true},"@vue/cli-plugin-vuex":{},"@vue/cli-plugin-eslint":{"config":"prettier","lintOn":["save"]}},"vueVersion":"3"}'
    
  • 提前配置npm镜像源
    预先将npm默认镜像源设置为npmmirror,避免触发速度检查:

    npm config set registry https://registry.npmmirror.com
    

    执行完该命令后再运行原Vue CLI创建命令即可。

  • 全局配置Vue CLI禁用提示
    创建或修改全局Vue CLI配置文件~/.vuerc,添加以下内容:

    {
      "useTaobaoRegistry": false
    }
    

    该配置会长期禁用Vue CLI自动检查和切换镜像源的提示。

内容的提问来源于stack exchange,提问作者Stiegi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 16:05:12