解决liunx系统,项目nuxt2.0运行npm run dev / start报错问题

npm run dev 运行nuxt2.0项目时,报错:

查看了下core-js3.0.0安装包,发现里面modules的名称修改为es.,而不是es6.

 ERROR  Failed to compile with 45 errors                         friendly-errors 16:02:13

These dependencies were not found:                               friendly-errors 16:02:13
                                                                 friendly-errors 16:02:13
* core-js/modules/es6.array.find in ./.nuxt/client.js            friendly-errors 16:02:13
* core-js/modules/es6.array.find-index in ./node_modules/_babel-loader@8.0.5@babel-loader/li                                                                                                                   b??ref--2-0!./node_modules/_vue-loader@15.7.0@vue-loader/lib??vue-loader-options!./pages/ind                                                                                                                   ex.vue?vue&type=script&lang=js&
* core-js/modules/es6.array.iterator in ./.nuxt/client.js        friendly-errors 16:02:13
* core-js/modules/es6.date.to-string in ./.nuxt/utils.js, ./node_modules/_babel-loader@8.0.5                                                                                                                   @babel-loader/lib??ref--2-0!./node_modules/_vue-loader@15.7.0@vue-loader/lib??vue-loader-opt                                                                                                                   ions!./components/upload.vue?vue&type=script&lang=js& and 1 other
* core-js/modules/es6.function.name in ./.nuxt/client.js, ./node_modules/_babel-loader@8.0.5                                                                                                                   @babel-loader/lib??ref--2-0!./node_modules/_vue-loader@15.7.0@vue-loader/lib??vue-loader-opt                                                                                                                   ions!./components/upload.vue?vue&type=script&lang=js& and 1 other
* core-js/modules/es6.number.constructor in ./node_modules/_babel-loader@8.0.5@babel-loader/                                                                                                                   lib??ref--2-0!./node_modules/_vue-loader@15.7.0@vue-loader/lib??vue-loader-options!./compone                                                                                                                   nts/upload.vue?vue&type=script&lang=js&
* core-js/modules/es6.object.assign in ./.nuxt/client.js         friendly-errors 16:02:13
* core-js/modules/es6.object.keys in ./.nuxt/client.js           friendly-errors 16:02:13
* core-js/modules/es6.object.to-string in ./.nuxt/client.js, ./node_modules/_babel-loader@8.                                                                                                                   0.5@babel-loader/lib??ref--2-0!./node_modules/_vue-loader@15.7.0@vue-loader/lib??vue-loader-                                                                                                                   options!./components/upload.vue?vue&type=script&lang=js& and 3 others
* core-js/modules/es6.promise in ./.nuxt/client.js               friendly-errors 16:02:13
* core-js/modules/es6.regexp.constructor in ./.nuxt/utils.js     friendly-errors 16:02:13
* core-js/modules/es6.regexp.match in ./.nuxt/client.js          friendly-errors 16:02:13
* core-js/modules/es6.regexp.replace in ./.nuxt/utils.js, ./node_modules/_babel-loader@8.0.5                                                                                                                   @babel-loader/lib??ref--2-0!./node_modules/_vue-loader@15.7.0@vue-loader/lib??vue-loader-opt                                                                                                                   ions!./pages/login.vue?vue&type=script&lang=js& and 1 other
* core-js/modules/es6.regexp.search in ./.nuxt/utils.js          friendly-errors 16:02:13
* core-js/modules/es6.regexp.split in ./.nuxt/utils.js           friendly-errors 16:02:13
* core-js/modules/es6.regexp.to-string in ./.nuxt/utils.js, ./node_modules/_babel-loader@8.0                                                                                                                   .5@babel-loader/lib??ref--2-0!./node_modules/_vue-loader@15.7.0@vue-loader/lib??vue-loader-o                                                                                                                   ptions!./components/upload.vue?vue&type=script&lang=js& and 1 other
* core-js/modules/es6.string.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.cli                                                                                                                   ent.js and 1 other
* core-js/modules/es6.string.iterator in ./.nuxt/client.js       friendly-errors 16:02:13
* core-js/modules/es6.string.link in ./plugins/marked.js         friendly-errors 16:02:13
* core-js/modules/es6.string.repeat in ./.nuxt/utils.js          friendly-errors 16:02:13
* core-js/modules/es6.string.starts-with in ./.nuxt/utils.js     friendly-errors 16:02:13
* core-js/modules/es6.symbol in ./.nuxt/axios.js, ./.nuxt/components/nuxt-link.client.js
* core-js/modules/es7.array.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.clie                                                                                                                   nt.js and 1 other
* core-js/modules/es7.promise.finally in ./.nuxt/client.js       friendly-errors 16:02:13
* core-js/modules/es7.symbol.async-iterator in ./.nuxt/axios.js, ./.nuxt/components/nuxt-lin                                                                                                                   k.client.js
* core-js/modules/web.dom.iterable in ./.nuxt/axios.js, ./.nuxt/components/nuxt-link.client.                                                                                                                   js
                                                                 friendly-errors 16:02:13
To install them, you can run: npm install --save core-js/modules/es6.array.find core-js/modu                                                                                                                   les/es6.array.find-index core-js/modules/es6.array.iterator core-js/modules/es6.date.to-stri                                                                                                                   ng core-js/modules/es6.function.name core-js/modules/es6.number.constructor core-js/modules/                                                                                                                   es6.object.assign core-js/modules/es6.object.keys core-js/modules/es6.object.to-string core-                                                                                                                   js/modules/es6.promise core-js/modules/es6.regexp.constructor core-js/modules/es6.regexp.mat                                                                                                                   ch core-js/modules/es6.regexp.replace core-js/modules/es6.regexp.search core-js/modules/es6.                                                                                                                   regexp.split core-js/modules/es6.regexp.to-string core-js/modules/es6.string.includes core-j                                                                                                                   s/modules/es6.string.iterator core-js/modules/es6.string.link core-js/modules/es6.string.rep                                                                                                                   eat core-js/modules/es6.string.starts-with core-js/modules/es6.symbol core-js/modules/es7.ar                                                                                                                   ray.includes core-js/modules/es7.promise.finally core-js/modules/es7.symbol.async-iterator c                                                                                                                   ore-js/modules/web.dom.iterable
ℹ Waiting for file changes    

需要降回2.6.2版本才能正常运行

npm install --save core-js@latest2.6.2
    原文作者:凯迪Wen
    原文地址: https://segmentfault.com/a/1190000018647030
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞