3
2

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.

新規に作成したNuxt.js(TypeScript)でビルド時にエラーが出たので対応

Last updated at Posted at 2020-06-13

状況

Nuxt.js 2.12.2

yarn create nuxt-app xxx でNuxt.jsをインストール
※TypeScriptを選択

起きたこと

インストールしたてのNuxt.jsプロジェクトでyarn devを実行すると以下のエラーが発生。

 ERROR  ERROR in <~~~略~~~>/node_modules/@nuxt/types/config/router.d.ts(14,27):                                                                                                                                                                                                                      nuxt:typescript 01:30:32
14:27 Property 'component' does not exist on type 'RouteConfig'.
    12 |   chunkName?: string
    13 |   chunkNames?: Record<string, string>
  > 14 |   component?: RouteConfig['component'] | string
       |                           ^
    15 | }
    16 | 
    17 | export interface NuxtConfigurationRouter extends RouterOptions {

対応

package.jsonにて、以下を修正して yarn install

package.json
- "@nuxt/typescript-build": "^0.6.0",
+ "@nuxt/typescript-build": "^1.0.0",

現時点(6/14)時点での最新は v1.0.3

@nuxt/typesのバージョンが原因と推測

v0.6.6@nuxt/typesv0.7.5
v1.0.3@nuxt/typesv0.7.9

追記

create-nuxt-appの方でアップデート対応は進めている模様。
https://github.com/nuxt/create-nuxt-app/commit/8c218b173e6516d36387e4643af1a9b3e34833a2

追記(2020/6/21)

create-nuxt-appv.3.0.0が2日前にリリースされていた。
https://github.com/nuxt/create-nuxt-app/releases/tag/v3.0.0

@nuxt/typescript-buildのバージョンも上がっていました。
https://github.com/nuxt/create-nuxt-app/compare/v2.15.0...v3.0.0#diff-5212c900202683c83d4e8b8d31ccf957R27

3
2
1

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
3
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?