npm install 报错

npm install 报错

npm install 报错

java 复制代码
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: yudao-ui-admin@1.8.0-snapshot
npm ERR! Found: eslint@7.15.0
npm ERR! node_modules/eslint
npm ERR!   dev eslint@"7.15.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer eslint@">= 1.6.0 < 7.0.0" from @vue/cli-plugin-eslint@4.5.18
npm ERR! node_modules/@vue/cli-plugin-eslint
npm ERR!   dev @vue/cli-plugin-eslint@"4.5.18" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! C:\Users\HX\AppData\Local\npm-cache\_logs\2023-08-30T14_59_25_161Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in: C:\Users\HX\AppData\Local\npm-cache\_logs\2023-08-30T14_59_25_161Z-debug-0.log

D:\WorkSpace\ruoyi-vue-pro\yudao-ui-admin>npm cache clear --forc
npm WARN using --force Recommended protections disabled.

解决方案:

npm install --legacy-peer-deps

不支持nodejs 18 报错

java 复制代码
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@achrinza/node-ipc@9.2.2',
npm WARN EBADENGINE   required: { node: '8 || 10 || 12 || 14 || 16 || 17' },
npm WARN EBADENGINE   current: { node: 'v18.17.1', npm: '9.6.7' }
npm WARN EBADENGINE }
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: 'pkcs7@0.2.3',
npm WARN EBADENGINE   required: { npm: '^1.4.6', node: '^0.10' },
npm WARN EBADENGINE   current: { node: 'v18.17.1', npm: '9.6.7' }
npm WARN EBADENGINE }

解决方案:

在package-lock.json文件中修改

java 复制代码
      "engines": {
        "node": "8 || 10 || 12 || 14 || 16 || 17 || 18"
      }

在package.json可能需要添加属性 .

SET NODE_OPTIONS=--openssl-legacy-provider

java 复制代码
  "scripts": {
    "local": "SET NODE_OPTIONS=--openssl-legacy-provider &&  vue-cli-service serve --mode local",
    "dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --mode dev",
    "front": "vue-cli-service serve --mode front",
    "build:prod": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode prod",
    "build:stage": "vue-cli-service build --mode stage",
    "build:dev": "SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service build --mode dev",
    "build:static": "vue-cli-service build --mode static",
    "preview": "node build/index.js --preview",
    "lint": "eslint --ext .js,.vue src",
    "clean": "rimraf node_modules"
  },

直接启动

npm run dev

java 复制代码
> yudao-ui-admin@1.8.0-snapshot dev
> SET NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve --mode dev

Browserslist: caniuse-lite is outdated. Please run:
  npx update-browserslist-db@latest
  Why you should do it regularly: https://github.com/browserslist/update-db#readme
 INFO  Starting development server...
98% after emitting CopyPlugin

 DONE  Compiled successfully in 29648ms                                                                                                                                                                                       23:20:59

  App running at:
  - Local:   http://localhost:81/
  - Network: http://192.168.1.102:81/
相关推荐
两只羊ovo1 分钟前
MCP:AI 界的 USB-C,把模型和世界「插」起来
前端
Darling噜啦啦6 分钟前
JWT 登录鉴权全链路:从 Zustand 状态管理到 Axios 拦截器,彻底搞懂前端鉴权工程
前端
可涵不会debug8 分钟前
LangChain 示例选择器(Example selectors)完整基础概念解读
服务器·前端·数据库
Csvn9 分钟前
😱 React `<StrictMode>`:为什么 useEffect 被调用了两次?别慌,这是特性不是 bug
前端
Asize14 分钟前
2 道大厂面试题:TS 工具类型我懂了,CSS 3 列布局把我问住了
前端·css·typescript
胡萝卜术17 分钟前
从"氛围编程"到规范驱动:两次创造如何让 AI 协作从碰运气变成工程流水线
前端·面试·github
Imchendiana18 分钟前
《狂人日记NO.11》— 给 AI 装一本"项目说明书":我把"自己"蒸馏成了一个编码知识库Skill
前端·ai编程
l12586519 分钟前
# RAG多轮对话检索设计:Query重写如何让“那它呢“变成完整问题
前端·数据库·人工智能·python·算法·fastapi·milvus
এ慕ོ冬℘゜22 分钟前
前端实战:使用 jQuery 与 CSS3 打造动态数据表格与滑块交互
前端·css3·jquery
Csvn23 分钟前
✂️ AbortController:一个 API 统一取消 fetch、事件监听与 AI 流式请求
前端