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/
相关推荐
逐·風4 小时前
unity关于自定义渲染、内存管理、性能调优、复杂物理模拟、并行计算以及插件开发
前端·unity·c#
Devil枫4 小时前
Vue 3 单元测试与E2E测试
前端·vue.js·单元测试
尚梦5 小时前
uni-app 封装刘海状态栏(适用小程序, h5, 头条小程序)
前端·小程序·uni-app
GIS程序媛—椰子5 小时前
【Vue 全家桶】6、vue-router 路由(更新中)
前端·vue.js
前端青山6 小时前
Node.js-增强 API 安全性和性能优化
开发语言·前端·javascript·性能优化·前端框架·node.js
毕业设计制作和分享6 小时前
ssm《数据库系统原理》课程平台的设计与实现+vue
前端·数据库·vue.js·oracle·mybatis
清灵xmf8 小时前
在 Vue 中实现与优化轮询技术
前端·javascript·vue·轮询
大佩梨8 小时前
VUE+Vite之环境文件配置及使用环境变量
前端
GDAL8 小时前
npm入门教程1:npm简介
前端·npm·node.js
小白白一枚1119 小时前
css实现div被图片撑开
前端·css