Nuxt.js で build すると Can’t resolve ‘core-js/modules/… のエラーが出た

  • Nuxt.js

Nuxt.js でビルドしてみたら、とんでもない量のエラーが出た。

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.array.iterator' in '...\.nuxt'
 @ ./.nuxt/client.js 14:0-44
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.date.to-string' in '...\.nuxt'
 @ ./.nuxt/utils.js 9:0-44
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt.js
Module not found: Error: Can't resolve 'core-js/modules/es6.date.to-string' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt.js 2:0-44
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.function.name' in '...\.nuxt'
 @ ./.nuxt/client.js 13:0-43
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/index.js
Module not found: Error: Can't resolve 'core-js/modules/es6.function.name' in '...\.nuxt'
 @ ./.nuxt/index.js 9:0-43
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.function.name' in '...\.nuxt'
 @ ./.nuxt/utils.js 19:0-43
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.assign' in '...\.nuxt'
 @ ./.nuxt/client.js 16:0-43
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/index.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.keys' in '...\.nuxt'
 @ ./.nuxt/index.js 6:0-41
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.keys' in '...\.nuxt'
 @ ./.nuxt/utils.js 18:0-41
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.keys' in '...\.nuxt'
 @ ./.nuxt/client.js 12:0-41
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/index.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.to-string' in '...\.nuxt'
 @ ./.nuxt/index.js 5:0-46
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.to-string' in '...\.nuxt'
 @ ./.nuxt/utils.js 17:0-46
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/App.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.to-string' in '...\.nuxt'
 @ ./.nuxt/App.js 2:0-46
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/router.scrollBehavior.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.to-string' in '...\.nuxt'
 @ ./.nuxt/router.scrollBehavior.js 1:0-46
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.to-string' in '...\.nuxt'
 @ ./.nuxt/client.js 11:0-46
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt-link.client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.to-string' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt-link.client.js 1:0-46
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt.js
Module not found: Error: Can't resolve 'core-js/modules/es6.object.to-string' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt.js 3:0-46
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.promise' in '...\.nuxt'
 @ ./.nuxt/client.js 15:0-37
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.regexp.constructor' in '...\.nuxt'
 @ ./.nuxt/utils.js 10:0-48
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.regexp.match' in '...\.nuxt'
 @ ./.nuxt/client.js 6:0-42
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.regexp.replace' in '...\.nuxt'
 @ ./.nuxt/utils.js 12:0-44
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt.js
Module not found: Error: Can't resolve 'core-js/modules/es6.regexp.replace' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt.js 4:0-44
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.regexp.search' in '...\.nuxt'
 @ ./.nuxt/utils.js 11:0-43
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.regexp.split' in '...\.nuxt'
 @ ./.nuxt/utils.js 4:0-42
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.regexp.to-string' in '...\.nuxt'
 @ ./.nuxt/utils.js 8:0-46
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt.js
Module not found: Error: Can't resolve 'core-js/modules/es6.regexp.to-string' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt.js 1:0-46
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.string.includes' in '...\.nuxt'
 @ ./.nuxt/client.js 9:0-45
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt-link.client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.string.includes' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt-link.client.js 6:0-45
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.string.iterator' in '...\.nuxt'
 @ ./.nuxt/utils.js 15:0-45
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/App.js
Module not found: Error: Can't resolve 'core-js/modules/es6.string.iterator' in '...\.nuxt'
 @ ./.nuxt/App.js 3:0-45
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.string.iterator' in '...\.nuxt'
 @ ./.nuxt/client.js 1:0-45
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.string.repeat' in '...\.nuxt'
 @ ./.nuxt/utils.js 6:0-43
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.string.starts-with' in '...\.nuxt'
 @ ./.nuxt/utils.js 5:0-48
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es6.symbol' in '...\.nuxt'
 @ ./.nuxt/utils.js 2:0-36
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/index.js
Module not found: Error: Can't resolve 'core-js/modules/es6.symbol' in '...\.nuxt'
 @ ./.nuxt/index.js 3:0-36
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.symbol' in '...\.nuxt'
 @ ./.nuxt/client.js 3:0-36
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt-link.client.js
Module not found: Error: Can't resolve 'core-js/modules/es6.symbol' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt-link.client.js 3:0-36
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es7.array.includes' in '...\.nuxt'
 @ ./.nuxt/client.js 8:0-44
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt-link.client.js
Module not found: Error: Can't resolve 'core-js/modules/es7.array.includes' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt-link.client.js 5:0-44
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/es7.object.get-own-property-descriptors' in '...\.nuxt'
 @ ./.nuxt/utils.js 1:0-65
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/index.js
Module not found: Error: Can't resolve 'core-js/modules/es7.object.get-own-property-descriptors' in '...\.nuxt'
 @ ./.nuxt/index.js 2:0-65
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es7.promise.finally' in '...\.nuxt'
 @ ./.nuxt/client.js 17:0-45
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/es7.symbol.async-iterator' in '...\.nuxt'
 @ ./.nuxt/client.js 2:0-51
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt-link.client.js
Module not found: Error: Can't resolve 'core-js/modules/es7.symbol.async-iterator' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt-link.client.js 2:0-51
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/App.js
Module not found: Error: Can't resolve 'core-js/modules/web.dom.iterable' in '...\.nuxt'
 @ ./.nuxt/App.js 1:0-42
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/client.js
Module not found: Error: Can't resolve 'core-js/modules/web.dom.iterable' in '...\.nuxt'
 @ ./.nuxt/client.js 10:0-42
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/index.js
Module not found: Error: Can't resolve 'core-js/modules/web.dom.iterable' in '...\.nuxt'
 @ ./.nuxt/index.js 4:0-42
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/utils.js
Module not found: Error: Can't resolve 'core-js/modules/web.dom.iterable' in '...\.nuxt'
 @ ./.nuxt/utils.js 16:0-42
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./.nuxt/components/nuxt-link.client.js
Module not found: Error: Can't resolve 'core-js/modules/web.dom.iterable' in '...\.nuxt\components'
 @ ./.nuxt/components/nuxt-link.client.js 4:0-42
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

ERROR in ./pages/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&)
Module not found: Error: Can't resolve '~/components/AppLogo.vue' in '...\pages'
 @ ./pages/index.vue?vue&type=script&lang=js& (./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./pages/index.vue?vue&type=script&lang=js&) 21:0-47
 @ ./pages/index.vue?vue&type=script&lang=js&
 @ ./pages/index.vue
 @ ./.nuxt/router.js
 @ ./.nuxt/index.js
 @ ./.nuxt/client.js
 @ multi ./.nuxt/client.js

そのほとんどが core-js に関連するもので、「読み込もうとしてるモジュールがないよ」っていう感じだったので見てみると、確かに node_modules/core-js/modules/ の中に該当のファイルが無かった。

調べてみると、3系でダメになったとのこと。ファイルが削除されたんでしょうか。

仕方がないので2系を入れてみたら、確かに動くようになった。これは nuxt 側がなんとかしてくれないとどうしようもないのかなー。

yarn add [email protected]