
あきぞらです。
Vue.jsのプロジェクトを作ろうとして、npm run build を実行したら、表題のエラーがでました。
ハマりかけましたが、意外とすぐに解決できたのでその方法を紹介したいと思います。
事象
npm のプロジェクトを作成し、npm run build を実行したところ、以下のようなエラーが。
$ npm run build ... ... ⠹ Building for production... ERROR Failed to compile with 13 errors These dependencies were not found: * core-js/modules/es6.array.find-index in ./src/components/... * core-js/modules/es6.array.iterator in ./node_modules/... * core-js/modules/es6.number.constructor in ./node_modules/... * .... * ....
何か設定をミスったのかな?
と思いソースコードを調べてみるも、わからず。
原因と解消方法
調べると、どうもcore-jsのバージョン周りが怪しいらしい。
バージョン2系のcore-jsをインストールする必要がありそう。
ということで、インストールしてみます。
$ npm add core-js@2
再度npm run build してみると...動きました。
package.jsonのバージョンも確認して問題ないことをチェックします。
"dependencies": { "bootstrap": "^4.3.1", "chartist": "^0.11.0", "core-js": "^2.6.11", "core.js": "^0.4.2", "google-maps": "^3.2.1", "register-service-worker": "^1.5.2", "v-tooltip": "^2.0.0-rc.33", "vue": "^2.6.6", "vue-router": "^3.0.2", "vue2-google-maps": "^0.8.4" },