Indie-Kart / ecommerce-store

https://indiekart.vercel.app/
MIT License
39 stars 59 forks source link

[BUG]:Cannot find module 'next/navigation' or its corresponding type declarations #195

Open iamabhishek2828 opened 3 days ago

iamabhishek2828 commented 3 days ago

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

  1. Install the latest version of Next.js and TypeScript.
  2. Create a page.tsx file with the following content:

    import { notFound } from 'next/navigation';
    
    export default function NotFoundCatchAll() {
     notFound();
    }
  3. Ensure your tsconfig.json includes the relevant settings for Next.js (see below).
  4. Run the Next.js development server.

    Expected Behavior

    The next/navigation module should be resolved without any errors.

    Actual Behavior

    The following error occurs:

    Cannot find module 'next/navigation' or its corresponding type declarations.

tsconfig.json

{
  "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"]
}

Steps Taken to Resolve

Versions

Logs

/path/to/project/page.tsx:1:26
Cannot find module 'next/navigation' or its corresponding type declarations.

Environment

Record

github-actions[bot] commented 3 days ago

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.

iamabhishek2828 commented 3 days ago

/assign-me