web@0.0.1 dev C:\Users\israe\Documents\GitHub\webapp\apps\web next dev ▲ Next.js 14.2.12…
- User
web@0.0.1 dev C:\Users\israe\Documents\GitHub\webapp\apps\web next dev
▲ Next.js 14.2.12
- Local: http://localhost:3000
- Environments: .env
✓ Starting... ✓ Ready in 4.4s ○ Compiling / ... ⨯ ./src/app/page.tsx:4:1 Module not found: Can't resolve '@web/core/socket' 2 | import { useRouter } from 'next/navigation' 3 | import { useEffect } from 'react'
4 | import { useSocket } from '@web/core/socket' | ^ 5 | import { useGlobalService } from '@web/modules/global' 6 | import { useDesignSystem } from '@web/designSystem' 7 | import { useAuthentication } from '@web/domain/authentication'
https://nextjs.org/docs/messages/module-not-found ⨯ ./src/app/page.tsx:4:1 Module not found: Can't resolve '@web/core/socket' 2 | import { useRouter } from 'next/navigation' 3 | import { useEffect } from 'react'
4 | import { useSocket } from '@web/core/socket' | ^ 5 | import { useGlobalService } from '@web/modules/global' 6 | import { useDesignSystem } from '@web/designSystem' 7 | import { useAuthentication } from '@web/domain/authentication'
https://nextjs.org/docs/messages/module-not-found ⨯ ./src/app/page.tsx:4:1 Module not found: Can't resolve '@web/core/socket' 2 | import { useRouter } from 'next/navigation' 3 | import { useEffect } from 'react'
4 | import { useSocket } from '@web/core/socket' | ^ 5 | import { useGlobalService } from '@web/modules/global' 6 | import { useDesignSystem } from '@web/designSystem' 7 | import { useAuthentication } from '@web/domain/authentication'
https://nextjs.org/docs/messages/module-not-found GET / 500 in 8870ms ⨯ ./src/app/page.tsx:4:1 Module not found: Can't resolve '@web/core/socket' 2 | import { useRouter } from 'next/navigation' 3 | import { useEffect } from 'react'
4 | import { useSocket } from '@web/core/socket' | ^ 5 | import { useGlobalService } from '@web/modules/global' 6 | import { useDesignSystem } from '@web/designSystem' 7 | import { useAuthentication } from '@web/domain/authentication'
https://nextjs.org/docs/messages/module-not-found ⨯ ./src/app/page.tsx:4:1 Module not found: Can't resolve '@web/core/socket' 2 | import { useRouter } from 'next/navigation' 3 | import { useEffect } from 'react'
4 | import { useSocket } from '@web/core/socket' | ^ 5 | import { useGlobalService } from '@web/modules/global' 6 | import { useDesignSystem } from '@web/designSystem' 7 | import { useAuthentication } from '@web/domain/authentication'
https://nextjs.org/docs/messages/module-not-found ⨯ ./src/core/configuration/useConfiguration.tsx:1:1 Module not found: Can't resolve '@web/libraries/utility'
1 | import { Utility } from '@web/libraries/utility' | ^ 2 | import { ConfigurationType } from '@web/pages/api/configuration' 3 | import { 4 | ReactNode,
https://nextjs.org/docs/messages/module-not-found
Import trace for requested module: ./src/core/configuration/index.ts ./src/core/socket/socket.provider.tsx ./src/core/socket/index.tsx ./src/app/page.tsx
- Assistant
The error messages you're seeing indicate that your Next.js application is unable to resolve certain modules specified in your
page.tsxfile and other files. Here are some steps to help you resolve this issue:-
Check Module Paths:
- Make sure the import paths in your code are correct and point to the right locations. For instance, verify that the
@web/core/socketand@web/libraries/utilitypaths exist in your project. - If you're using
typesoften found in atsconfig.jsonwithbaseUrlorpaths, ensure that these configurations are correct and align with your directory structure.
- Make sure the import paths in your code are correct and point to the right locations. For instance, verify that the
-
Check for Missing Files:
- Verify that all necessary files and folders are present in your project directory. If any module has been deleted or moved, you'll need to update the import paths accordingly.
- Look for typos in filenames or paths that might be causing the import failure.
-
Dependencies and Aliases:
- If you're using module aliases (as suggested by the
@web/prefix), make sure they are properly set up in yourtsconfig.jsonorbabel.config.js. Here’s an example fromtsconfig.json:{ "compilerOptions": { "baseUrl": "src", "paths": { "@web/*": ["./*"] } } } - Check if the libraries you're trying to import from (e.g., third-party or internal npm packages) are correctly installed in your project.
- If you're using module aliases (as suggested by the
-
Rebuild the Project:
- Stop your development server and clear any caches that might be persisting incorrect states, often done by deleting
.next,node_modules, andpackage-lock.json, followed by reinstalling dependencies:rm -rf .next node_modules package-lock.json npm install
- Stop your development server and clear any caches that might be persisting incorrect states, often done by deleting
-
Check Your Git Branch or Merge Status:
- Make sure you are on the correct branch, and check if there are unmerged changes that might be causing some files to be absent.
-
Look at the Error Documentation:
- Each error provides a link to the Next.js documentation, which may provide additional context or troubleshooting steps specific to the issues you're facing.
-
Use Console Logs:
- Sometimes, adding console statements in your module resolving configuration files helps diagnose if paths are being interpreted correctly.
By systematically following these steps, you should be able to pinpoint the source of the issue and resolve the module resolution errors in your Next.js application.
-