错误描述
npm ERR! A complete log of this run can be found in:
npm ERR! /home/esp/.npm/_logs/2022-09-29T07_47_13_339Z-debug.log
ERROR Failed to compile with 45 errors 3:47:13 PM
These dependencies were not found:
- core-js/modules/es.array.push.js in ./node_modules/@babel_runtime@7.19.0@@babel/runtime/helpers/iterableToArrayLimit.js, ./node_modules/@babel_runtime@7.19.0@@babel/runtime/helpers/esm/regeneratorRuntime.js and
32 others - core-js/modules/es.array.unshift.js in ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.2.5@babel-
loader/lib!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.10.0@vue-loader/lib??vue-loader-options!./src/views/system/role/index.vue?vue&type=script&lang=js& - core-js/modules/es.error.cause.js in ./node_modules/@babel_runtime@7.19.0@@babel/runtime/helpers/nonIterableRest.js, ./node_modules/@babel_runtime@7.19.0@@babel/runtime/helpers/esm/classCallCheck.js and 7 others
- core-js/modules/es.object.proto.js in ./node_modules/_@babel_runtime@7.19.0@@babel/runtime/helpers/esm/regeneratorRuntime.js
To install them, you can run: npm install --save core-js/modules/es.array.push.js core-js/modules/es.array.unshift.js core-js/modules/es.error.cause.js core-js/modules/es.object.proto.js
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ruoyi@3.8.3 build:prod: vue-cli-service build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ruoyi@3.8.3 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
引起原因
看提示,缺少core-js包或者core-js包版本不对:
To install them, you can run: npm install --save core-js/modules/es.array.push.js core-js/modules/es.array.unshift.js core-js/modules/es.error.cause.js core-js/modules/es.object.proto.js
直接执行命令依旧报错:
提示没有core-js目录
解决办法
安装core-js模块
先删除node_modules 中的core-js文件夹,然后重新安装高版本
安装报错的插件
cnpm install --save core-js
@3.22.8
安装其他
cnpm i
打包
cnpm run build:prod