Module not found: Can't resolve '@/components #27666
Replies: 14 comments 36 replies
-
| who can help me | 
Beta Was this translation helpful? Give feedback.
-
| {
  "compilerOptions": {
    "baseUrl": "src",
    "paths": {
      "@/components/*": ["components/*"]
    }
  }
}See more: https://stackoverflow.com/questions/43281741/how-to-use-paths-in-tsconfig-json | 
Beta Was this translation helpful? Give feedback.
-
| Same problem for me | 
Beta Was this translation helpful? Give feedback.
-
| check if paths option is available both in tsconfig.json and jsconfig.json if you are using typescript or javascript. | 
Beta Was this translation helpful? Give feedback.
-
| I had to rename my dir name inside components from stepsInfo to steps-info My project setup was: project-root/ | 
Beta Was this translation helpful? Give feedback.
-
| You probably renamed folder in components, in my case I renamed components/UI to components/ui. 
 Then commit and push your changes. | 
Beta Was this translation helpful? Give feedback.
-
| // next.config.js
/** @type {import('next').NextConfig} */
const path = require('path');
const nextConfig = {
  webpack: (config) => {
    config.resolve.alias = {
      ...config.resolve.alias,
      '@': path.resolve(__dirname, './'),
    };
    return config;
  },
};
module.exports = nextConfig; | 
Beta Was this translation helpful? Give feedback.
-
| "paths": { | 
Beta Was this translation helpful? Give feedback.
-
| 👍🏼… On Mon, May 20, 2024, 12:44 Bo Kou ***@***.***> wrote:
 You saved me today. Thanks!
 —
 Reply to this email directly, view it on GitHub
 <#27666 (reply in thread)>,
 or unsubscribe
 <https://github.com/notifications/unsubscribe-auth/BARC4ZCPQ7SNYI5CCLYKELTZDGPFZAVCNFSM5BLU5672U5DIOJSWCZC7NNSXTOKENFZWG5LTONUW63SDN5WW2ZLOOQ5TSNBZGMYTCMY>
 .
 You are receiving this because you commented.Message ID: <vercel/next.
 ***@***.***>
 | 
Beta Was this translation helpful? Give feedback.
-
| I encountered the same issue during next build in my pipelines. Here's a breakdown of the problem and solution: Problem: 
 Solution: 
 | 
Beta Was this translation helpful? Give feedback.
-
| If you are not using typescript, try deleting tsconfig.json | 
Beta Was this translation helpful? Give feedback.
-
| Issue Breakdown : Module not found despite of right path. Solution :  I was using  Conslole error :- ./src/app/layout.js .... more of this paths down | 
Beta Was this translation helpful? Give feedback.
-
| For me it was related to a file name case with absolute import. The following removed the cache and deployment worked fine. 
 | 
Beta Was this translation helpful? Give feedback.
-
| I encountered a similar issue while working on a Next.js project using Javascript. I accidentally created a file with  Solution: Delete the Typescript related files then restart the server using npm run dev your issue should be resolved | 
Beta Was this translation helpful? Give feedback.

Uh oh!
There was an error while loading. Please reload this page.
-
I add jsconfig.json
but when I run is error
Beta Was this translation helpful? Give feedback.
All reactions