当前位置: 首页 > news >正文

vue2老版本 npm install 安装失败_安装卡主

vue2老版本 npm install 安装失败_安装卡主

特别说明:vue2老版本安装慢、运行慢,建议升级vue3+element plus+ vite

解决方案1:

第一步、修改npm 镜像为国内镜像

使用淘宝镜像:

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

清除缓存:

npm cache clean --force

查看镜像配置是否成功:

npm config set registry


第二步、升级 vue-core-js版本

   "core-js": "^3.6.5" 升级版本直接修改版本号

{
  "name": "back",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "serve": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
    "build": "set NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build",
    "lint": "vue-cli-service lint"
  },
  "dependencies": {
    "core-js": "^3.6.5",
    "element-ui": "^2.15.0",
    "vue": "^2.6.11",
    "vue-clipboard3": "^2.0.0",
    "vue-router": "^3.5.3",
    "vue-ueditor-wrap": "^2.4.4"
  },
  "devDependencies": {
    "@vue/cli-plugin-babel": "~4.5.0",
    "@vue/cli-plugin-eslint": "~4.5.0",
    "@vue/cli-plugin-router": "^4.5.11",
    "@vue/cli-service": "~4.5.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-vue": "^6.2.2",
    "vue-template-compiler": "^2.6.11"
  },
  "eslintConfig": {
    "root": true,
    "env": {
      "node": true,
      "browser": true,
      "jquery": true
    },
    "extends": [
      "plugin:vue/essential",
      "eslint:recommended"
    ],
    "parserOptions": {
      "parser": "babel-eslint"
    },
    "rules": {
      "no-console": "off",
      "no-unused-vars": "off",
      "no-undef": "off",
      "generator-star-spacing": "off",
      "no-tabs": "off",
      "no-irregular-whitespace": "off",
      "no-debugger": "off",
      "no-redeclare": "off",
      "no-inner-declarations": "off",
      "no-unused-labels": "off",
      "vue/no-unused-vars": "off",
      "vue/no-unused-components": "off"
    }
  },
  "browserslist": [
    "> 1%",
    "last 2 versions",
    "not dead"
  ]
}

删除文件 package-lock.json

第三步,重新执行安装命令

npm  i

安装时间还是比较长,大约10分钟左右; 

解决方案2:

还有一种方案,可以复制其他项目已经安装成功的 node_modules 文件夹,直接复制。

文件夹内容比较大 >100mb

更多:

Vue3.4+element-plus2.5 + Vite 搭建教程整理

Vite 下一代的前端工具链,前端开发与构建工具

基于Vue的移动端UI框架整理

相关文章:

  • 【PL/SQL】常用操作复习20250212
  • 大型语言模型的核心机制解析
  • 随着人们网络安全意识提高,软件架构设计与评估也成为重中之重
  • 新一代SCADA: 宏集Panorama Suite 2025 正式发布,提供更灵活、符合人体工学且安全的应用体验
  • 【工业安全】-CVE-2019-17621-D-Link Dir-859L 路由器远程代码执行漏洞
  • 美团一面,有点难度。
  • verilog练习:i2c slave 模块设计
  • zyNo.22
  • Ansible内置模块之file
  • 从零搭建:Canal实时数据管道打通MySQL与Elasticsearch
  • 在大型语言模型(LLM)框架内Transformer架构与混合专家(MoE)策略的概念整合
  • 数据结构(5)
  • DeepSeek 的含金量还在上升
  • 2025年3月一区SCI-混沌进化优化算法Chaotic evolution optimization-附Matlab免费代码
  • 《AdaAttN:重新审视任意风格迁移中的注意力机制》学习笔记
  • Win10环境借助DockerDesktop部署大数据时序数据库Apache Druid
  • HCIA项目实践---OSPF的基本配置
  • 15种时间序列预测方法总结(包含多种方法代码实现)
  • github - 使用
  • MySQL事务
  • 占地57亩的“潮汕豪宅”面临强制拆除:曾被实施没收,8年间举行5次听证会
  • 商人运作亿元“茅台酒庞氏骗局”,俩客户自认受害人不服“从犯”判决提申诉
  • 马上评|“为偶像正名”的正确做法是什么
  • “异常”只停留在医院里,用艺术为“泡泡宝贝”加油
  • 大英博物馆展歌川广重:他是梵高最钟爱的浮世绘名家
  • 北京“准80后”干部兰天跨省份调任新疆生态环境厅副厅长