同一个项目(同样的工程),我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/es.array.concat in ./src/router/index.js
* core-js/modules/es.array.every in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-calc/CcTableCalc.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/table/Index.vue?vue&type=script&lang=js&
* core-js/modules/es.array.filter in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/select-tree/CcSelectTree.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/tab-menu/CcTabMenu.vue?vue&type=script&lang=js& and 1 other
* core-js/modules/es.array.for-each in ./packages/index.js, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/CcMenu.vue?vue&type=script&lang=js& and 6 others
* core-js/modules/es.array.from in ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js, ./node_modules/@babel/runtime/helpers/esm/iterableToArray.js
* core-js/modules/es.array.index-of in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/CcMenu.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/select-tree/CcSelectTree.vue?vue&type=script&lang=js& and 4 others
* core-js/modules/es.array.join in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/tree/Index.vue?vue&type=script&lang=js&
* core-js/modules/es.array.map in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/CcMenu.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-calc/CcTableCalc.vue?vue&type=script&lang=js& and 4 others
* core-js/modules/es.array.reduce in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/table-calc/CcTableCalc.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/table/Index.vue?vue&type=script&lang=js&
* core-js/modules/es.array.slice in ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js
* core-js/modules/es.array.splice in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/calendar/CcCalendar.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/comboMenu/Index.vue?vue&type=script&lang=js& and 2 others
* core-js/modules/es.function.name in ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js, ./packages/index.js and 20 others
* core-js/modules/es.number.constructor in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/calendar/CcCalendar.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/dialog/CcDialog.vue?vue&type=script&lang=js& and 6 others
* core-js/modules/es.number.to-fixed in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/table/Index.vue?vue&type=script&lang=js&
* core-js/modules/es.object.keys in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/tab-menu/CcTabMenu.vue?vue&type=script&lang=js&, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree/CcTree.vue?vue&type=script&lang=js&
* core-js/modules/es.object.to-string in ./node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js, ./node_modules/@babel/runtime/helpers/esm/typeof.js and 11 others
* core-js/modules/es.object.values in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/tree/CcTree.vue?vue&type=script&lang=js&, ./src/components/index.js
* core-js/modules/es.regexp.constructor in ./packages/polyfill.js, ./packages/utils.js
* core-js/modules/es.regexp.exec in ./packages/polyfill.js, ./packages/utils.js and 1 other
* core-js/modules/es.regexp.to-string in ./node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js, ./packages/polyfill.js and 3 others
* core-js/modules/es.string.ends-with in ./src/views/services/comboMenu/menus.js
* core-js/modules/es.string.iterator in ./node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js, ./node_modules/@babel/runtime/helpers/esm/typeof.js and 2 others
* core-js/modules/es.string.replace in ./packages/polyfill.js
* core-js/modules/es.string.search in ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./src/views/services/comboMenu/SubPage.vue?vue&type=script&lang=js&
* core-js/modules/es.string.starts-with in ./packages/polyfill.js
* core-js/modules/es.symbol in ./node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js, ./node_modules/@babel/runtime/helpers/esm/typeof.js and 1 other
* core-js/modules/es.symbol.description in ./node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js, ./node_modules/@babel/runtime/helpers/esm/typeof.js and 1 other
* core-js/modules/es.symbol.iterator in ./node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js, ./node_modules/@babel/runtime/helpers/esm/typeof.js and 1 other
* core-js/modules/web.dom-collections.for-each in ./packages/index.js, ./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/menu/CcMenu.vue?vue&type=script&lang=js& and 6 others
* core-js/modules/web.dom-collections.iterator in ./node_modules/@babel/runtime/helpers/esm/createForOfIteratorHelper.js, ./node_modules/@babel/runtime/helpers/esm/typeof.js and 2 others
To install them, you can run: npm install --save core-js/modules/es.array.concat core-js/modules/es.array.every core-js/modules/es.array.filter core-js/modules/es.array.for-each core-js/modules/es.array.from core-js/modules/es.array.index-of core-js/modules/es.array.join core-js/modules/es.array.map core-js/modules/es.array.reduce core-js/modules/es.array.slice core-js/modules/es.array.splice core-js/modules/es.function.name core-js/modules/es.number.constructor core-js/modules/es.number.to-fixed core-js/modules/es.object.keys core-js/modules/es.object.to-string core-js/modules/es.object.values core-js/modules/es.regexp.constructor core-js/modules/es.regexp.exec core-js/modules/es.regexp.to-string core-js/modules/es.string.ends-with core-js/modules/es.string.iterator core-js/modules/es.string.replace core-js/modules/es.string.search core-js/modules/es.string.starts-with core-js/modules/es.symbol core-js/modules/es.symbol.description core-js/modules/es.symbol.iterator core-js/modules/web.dom-collections.for-each core-js/modules/web.dom-collections.iterator
解决方案:
前面肯定时npm install下载了依赖,那怎么办。要仔细研究报错内容,发现最后一句:To install them, you can run: npm install --save core-js/modules/es.array.concat
是不是少了core-js?试试安装它,再看下一步缺少什么东西,继续装就行(不是缺心眼就行)
所有那就npm install core-js
再nmp run serve
运气真好,发现可以了,欧耶!!!
来源:oschina
链接:https://my.oschina.net/u/4361896/blog/4727318