VUE项目npm run serve报了好多个错: ERROR Failed to compile with 123 errors 解决方案

时间:2025-03-31 08:25:05

高手提供了一个项目框架的VUE模板,同一个项目(同样的工程),我npm run serve时报错,可另个人不会,说明工程项目木有问题,应该是我的环境有问题。各种百度各种让修改项目文件,我觉得木有必要,要对症下药。

报错内容: ERROR  Failed to compile with 123 errors (看这么多报错,吓我一跳)

PS D:\VueWorkspace\xxxxx> npm run serve

> cc-ui@1.1.5 serve D:\VueWorkspace\xxxxx
> vue-cli-service serve

 INFO  Starting development server...
98% after emitting CopyPlugin

 ERROR  Failed to compile with 123 errors                                                              4:12:14 ├F10: PM┤

These dependencies were not found:

* core-js/modules/ in ./src/router/
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-calc/?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/table/?vue&type=script&lang=js&
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/select-tree/?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/tab-menu/?vue&type=script&lang=js& and 1 other
* core-js/modules/-each in ./packages/, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/?vue&type=script&lang=js& and 6 others
* core-js/modules/ in ./node_modules/@babel/runtime/helpers/esm/, ./node_modules/@babel/runtime/helpers/esm/
* core-js/modules/-of in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/select-tree/?vue&type=script&lang=js& and 4 others
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/tree/?vue&type=script&lang=js&
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-calc/?vue&type=script&lang=js& and 4 others
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-calc/?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/table/?vue&type=script&lang=js&
* core-js/modules/ in ./node_modules/@babel/runtime/helpers/esm/
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/calendar/?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/comboMenu/?vue&type=script&lang=js& and 2 others
* core-js/modules/ in ./node_modules/@babel/runtime/helpers/esm/, ./packages/ and 20 others
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/calendar/?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/dialog/?vue&type=script&lang=js& and 6 others
* core-js/modules/-fixed in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/table/?vue&type=script&lang=js&
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/tab-menu/?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree/?vue&type=script&lang=js&
* core-js/modules/-string in ./node_modules/@babel/runtime/helpers/esm/, ./node_modules/@babel/runtime/helpers/esm/ and 11 others
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree/?vue&type=script&lang=js&, ./src/components/
* core-js/modules/ in ./packages/, ./packages/
* core-js/modules/ in ./packages/, ./packages/ and 1 other
* core-js/modules/-string in ./node_modules/@babel/runtime/helpers/esm/, ./packages/ and 3 others
* core-js/modules/-with in ./src/views/services/comboMenu/
* core-js/modules/ in ./node_modules/@babel/runtime/helpers/esm/, ./node_modules/@babel/runtime/helpers/esm/ and 2 others
* core-js/modules/ in ./packages/
* core-js/modules/ in ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/comboMenu/?vue&type=script&lang=js&
* core-js/modules/-with in ./packages/
* core-js/modules/ in ./node_modules/@babel/runtime/helpers/esm/, ./node_modules/@babel/runtime/helpers/esm/ and 1 other
* core-js/modules/ in ./node_modules/@babel/runtime/helpers/esm/, ./node_modules/@babel/runtime/helpers/esm/ and 1 other
* core-js/modules/ in ./node_modules/@babel/runtime/helpers/esm/, ./node_modules/@babel/runtime/helpers/esm/ and 1 other
* core-js/modules/-each in ./packages/, ./node_modules/cache-loader/dist/??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/?vue&type=script&lang=js& and 6 others
* core-js/modules/ in ./node_modules/@babel/runtime/helpers/esm/, ./node_modules/@babel/runtime/helpers/esm/ and 2 others

To install them, you can run: npm install --save core-js/modules/ core-js/modules/ core-js/modules/ core-js/modules/-each core-js/modules/ core-js/modules/-of core-js/modules/ core-js/modules/ core-js/modules/ core-js/modules/ core-js/modules/ core-js/modules/ core-js/modules/ core-js/modules/-fixed core-js/modules/ core-js/modules/-string core-js/modules/ core-js/modules/ core-js/modules/ core-js/modules/-string core-js/modules/-with core-js/modules/ core-js/modules/ core-js/modules/ core-js/modules/-with core-js/modules/ core-js/modules/ core-js/modules/ core-js/modules/-each core-js/modules/

解决方案:

前面肯定时npm install下载了依赖,那怎么办。要仔细研究报错内容,发现最后一句:To install them, you can run: npm install --save core-js/modules/

是不是少了core-js?试试安装它,再看下一步缺少什么东西,继续装就行(不是缺心眼就行)

所有那就npm install core-js

再nmp run serve

运气真好,发现可以了,欧耶!!!