Unable to import any module for nextjs

I’m having some trouble with my Next.js project and I’m hoping someone here might be able to help. Here’s the situation:

Issue: I’m trying to import modules in my Next.js project, but I keep running into errors indicating that modules cannot be resolved. For instance, when trying to import react-chartjs-2, I get the error Module not found: Can’t resolve ‘react-chartjs-2’.

Setup:

Next.js Version: 14.2.12 (as indicated in package.json)

Error Message: Next.js (14.2.5) out of date when running the project, even though package.json lists version 14.2.12.

Folder Structure: I have two directories in my project: nextjs and fastapi. Inside nextjs, there’s a node_modules folder and a package.json file.

Questions:

Why is there a version mismatch between package.json and the build error message?

Are there any issues or steps I might have missed that could cause modules to not be resolved correctly?

How can I make sure that my Next.js environment is correctly set up and using the right version?

Steps Taken:

I ran npm install in the nextjs folder to install dependencies and have tried reinstalling the dependency as well.

I’ve tried deleting and reinstalling node_modules but still get the same errors.

I checked that the correct Next.js version is listed in package.json, but the build process seems to be using an outdated version.

I’ve also tried npm i next@latest as well