user3513923
user3513923

Reputation: 9

Next.Js Module not found: Can't resolve after changing path

I am encountering an issue after changing the directory of the EmptyTable.tsx file. Initially, the file was located at views/forms-tables/tables/react-table/EmptyTable, and I decided to move it to a new location: components/Tables/EmptyTable. Despite updating the import path in my code to reflect this change, the compiler continues to show me an error message indicating that it cannot resolve the module.

Specifically, the error message states: "Module not found: Can't resolve 'views/forms-tables/tables/react-table/EmptyTable'". This error persists even though I have thoroughly checked and confirmed that the new import path is correct and the file exists in the specified directory. I have also ensured that there are no typos in the import statement and that I have saved all changes. Additionally, I have tried restarting the development server and clearing the cache, but the issue remains unresolved.

Failed to compile

Next.js (14.2.3)
./src/app/Client/(Payments)/Receipts/page.tsx:43:1
Module not found: Can't resolve 'views/forms-tables/tables/react-table/EmptyTable'
  41 | import IconButton from 'components/@extended/IconButton';
  42 | import Breadcrumbs from 'components/@extended/Breadcrumbs';
> 43 | import EmptyTables from 'views/forms-tables/tables/react-table/EmptyTable';
     | ^
  44 | import {
  45 |   CSVExport,
  46 |   HeaderSort,

https://nextjs.org/docs/messages/module-not-found

I treid to Clear Next.js Cache by using command: rm -rf .next but it still showing same message with old path

Upvotes: 0

Views: 553

Answers (1)

Raphael Canciani
Raphael Canciani

Reputation: 106

from what I can see, you are using this component in another file, and you need to edit the import in that file, in ./src/app/Client/(Payments)/Receipts/page.tsx you have the old import from views/forms-tables/tables/react-table/EmptyTable but you need to change it to something like components/Tables/EmptyTable this should solve your problem.

Upvotes: 0

Related Questions