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?

Cannot find module 'next/dist/shared/lib/app-router-context'の解決方法

Posted at

問題

Next.jsでビルド時に以下のエラーが表示された。

Type error: Cannot find module 'next/dist/shared/lib/app-router-context' or its corresponding type declarations.

解決方法

NavigateOptionsのimportパスをnext/dist/shared/lib/app-router-context.shared-runtimeに変更することで解決しました。

// ×修正前
import type { NavigateOptions } from 'next/dist/shared/lib/app-router-context';

// ⚪︎修正後
import type { NavigateOptions } from 'next/dist/shared/lib/app-router-context.shared-runtime';
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?