0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Vue + Typescript で forEach するとエラー core-js/modules/web.dom.iterable in ./src/main.ts

Posted at

エラー内容

$ yarn serve

# 中略

This dependency was not found:

* core-js/modules/web.dom.iterable in ./src/main.ts

To install it, you can run: npm install --save core-js/modules/web.dom.iterable
No type errors found
No lint errors found
Version: typescript 3.6.2, tslint 5.20.0
Time: 5261ms

$ yarn add core-js/modules/web.dom.iterable すると 405 エラー。

解決策

package.json の core-js のメージャーバージョンを 2 にしたら直りました。

package.json
  "dependencies": {
    "core-js": "^2.6.7",

$ vue create した時のデフォルトの core-js は 2 だったのですが
何かのタイミングで package.json を変更して 3 にしていたようです。

きっかけ

Vue.js - 基底コンポーネントの自動グローバル登録 をしようとしました。

requireComponent.keys().forEach(fileName => {
  // コンポーネントの自動登録
})

環境

$ vue -V
3.8.2

$ yarn -V
yarn install v1.17.3

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?