Open iamabhishek2828 opened 3 days ago
Cannot find module 'next/navigation' or its corresponding type declarations
I'm encountering an issue with the Next.js module next/navigation where TypeScript cannot find the module or its corresponding type declarations.
next/navigation
Create a page.tsx file with the following content:
page.tsx
import { notFound } from 'next/navigation'; export default function NotFoundCatchAll() { notFound(); }
tsconfig.json
The next/navigation module should be resolved without any errors.
The following error occurs:
Cannot find module 'next/navigation' or its corresponding type declarations.
{ "compilerOptions": { "typeRoots": ["./types", "./node_modules/@types"], "target": "es5", "lib": ["dom", "dom.iterable", "esnext"], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, "noEmit": true, "esModuleInterop": true, "module": "esnext", "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, "jsx": "preserve", "incremental": true, "plugins": [ { "name": "next" } ], "paths": { "@/*": ["./*"] } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], "exclude": ["node_modules"] }
node_modules
/path/to/project/page.tsx:1:26 Cannot find module 'next/navigation' or its corresponding type declarations.
Hello @iamabhishek2828! Thanks for creating issue #195 on #Indie-Kart/ecommerce-store.Please Comment /assign-me to self assign this issue to yourself, and please don't forget to star this repo.
/assign-me
Is there an existing issue for this?
What happened?
Title
Cannot find module 'next/navigation' or its corresponding type declarations
Description
I'm encountering an issue with the Next.js module
next/navigation
where TypeScript cannot find the module or its corresponding type declarations.Steps to Reproduce
Create a
page.tsx
file with the following content:tsconfig.json
includes the relevant settings for Next.js (see below).Expected Behavior
The
next/navigation
module should be resolved without any errors.Actual Behavior
The following error occurs:
tsconfig.json
Steps Taken to Resolve
node_modules
.Versions
Logs
Environment
Record