Nuxt.js yarn dev時に「To install them, you can run: npm install –save core-js/modules/es6.array.find」が発生した場合の対処法

Nuxt.jsでyarn dev実行時に「To install them, you can run: npm install –save core-js/modules/es6.array.find」が発生した場合の対処法を記述してます。
環境
- OS CentOS Linux release 8.0.1905 (Core)
- node V12.16.3
- npm 6.14.4
- nuxt 2.12.2
エラー全文
yarn dev実行時に発生。
ERROR Failed to compile with 39 errors friendly-errors 12:28:46
These dependencies were not found: friendly-errors 12:28:46
friendly-errors 12:28:46
* core-js/modules/es6.array.find in ./.nuxt/client.js friendly-errors 12:28:46
* core-js/modules/es6.array.from in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
* core-js/modules/es6.array.iterator in ./.nuxt/client.js friendly-errors 12:28:46
* core-js/modules/es6.date.to-string in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
* core-js/modules/es6.function.name in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
* core-js/modules/es6.object.assign in ./.nuxt/client.js friendly-errors 12:28:46
* core-js/modules/es6.object.keys in ./.nuxt/client.js friendly-errors 12:28:46
* core-js/modules/es6.object.to-string in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js and 1 other friendly-errors 12:28:46
* core-js/modules/es6.promise in ./.nuxt/client.js friendly-errors 12:28:46
* core-js/modules/es6.regexp.constructor in ./.nuxt/utils.js friendly-errors 12:28:46
* core-js/modules/es6.regexp.match in ./.nuxt/client.js friendly-errors 12:28:46
* core-js/modules/es6.regexp.replace in ./.nuxt/utils.js, ./.nuxt/components/nuxt.js friendly-errors 12:28:46
* core-js/modules/es6.regexp.search in ./.nuxt/utils.js friendly-errors 12:28:46
* core-js/modules/es6.regexp.split in ./.nuxt/utils.js, ./node_modules/babel-loader/lib??ref--2-0!./node_modules/vue-loader/lib??vue-loader-options!./.nuxt/components/nuxt-build-indicator.vue?vue&type=script&lang=js&
* core-js/modules/es6.regexp.to-string in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
* core-js/modules/es6.string.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
* core-js/modules/es6.string.iterator in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
* core-js/modules/es6.string.repeat in ./.nuxt/utils.js friendly-errors 12:28:46
* core-js/modules/es6.string.starts-with in ./.nuxt/utils.js friendly-errors 12:28:46
* core-js/modules/es6.symbol in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
* core-js/modules/es7.array.includes in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
* core-js/modules/es7.object.get-own-property-descriptors in ./.nuxt/index.js friendly-errors 12:28:46
* core-js/modules/es7.promise.finally in ./.nuxt/client.js friendly-errors 12:28:46
* core-js/modules/es7.symbol.async-iterator in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
* core-js/modules/web.dom.iterable in ./.nuxt/client.js, ./.nuxt/components/nuxt-link.client.js friendly-errors 12:28:46
friendly-errors 12:28:46
To install them, you can run: npm install --save core-js/modules/es6.array.find core-js/modules/es6.array.from core-js/modules/es6.array.iterator core-js/modules/es6.date.to-string core-js/modules/es6.function.name 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.match 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-js/modules/es6.string.iterator core-js/modules/es6.string.repeat core-js/modules/es6.string.starts-with core-js/modules/es6.symbol core-js/modules/es7.array.includes core-js/modules/es7.object.get-own-property-descriptors core-js/modules/es7.promise.finally core-js/modules/es7.symbol.async-iterator core-js/modules/web.dom.iterable

対処法
自分の環境の場合だと、下記の手順を実行して改善されました。
yarn add -D core-js@3 @babel/runtime-corejs3
上記を実行後に、nuxt.config.jsに下記を追加。
build: {
/*
** You can extend webpack config here
*/
babel: {
presets({ isServer }) {
return [
[
require.resolve('@nuxt/babel-preset-app'),
// require.resolve('@nuxt/babel-preset-app-edge'), // For nuxt-edge users
{
buildTarget: isServer ? 'server' : 'client',
corejs: { version: 3 }
}
]
]
}
},
extend (config, ctx) {
}
}
以上で、改善されました。
-
前の記事
Centos8 pnmpをインストールする手順 2020.06.15
-
次の記事
Nuxt.js ライブラリ「vue-roller」を使用して文字列にアニメーションをかける 2020.06.16
コメントを書く