skip to Main Content

Failed to compile

Next.js (14.2.4) ./src/app/layout.js:3:1 Module not found: Can’t
resolve ‘@/src/components/layout/Header’

The problem occurred out of nowhere 2 days ago the code was working fine and yesterday it started giving me this error.

The last thing I did was I linked it to MongoDB, I tried deleting .next, node_modules, updating…

2

Answers


  1. Chosen as BEST ANSWER

    Yes, i have found out that import Header from "F:/nov/src/components/layout/Header.js"; works, but dont know how to configure jsconfig so that the previous paths will work None of the imports work.


  2. Have you tried,

    instead of:

    import Header from "@/src/components/layout/Header";
    

    do this:

    import Header from "../components/layout/Header";
    

    Do the other imports work? Can they be resolved? Or is it only the Header component. Can you provide a more detailed description of the enviroment and maybe produce a minimal reproducer, which we can look into?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search