Starting a nextjs project, after running npx create-next-app@latest
trying to start the project with npm run dev
but failing. I’ve spent time reading relevant posts and have attempted all methods. Eg) full wipe of node/nvm from OS, using NVM.
Getting this during the build: wrong node version
Spun up a new vite app and opened some previous next.js projects without issue.
-
Full node wipe, and install from website dl to 20.10.0 so i don’t see why it’s pointing to v16.14.2 for some reason. I’ve tried using NVM to uninstall all other versions and set the default as well, still the same error as above. npx and npm both in the /bin appropriately.
-
Trying
npm i node @lts
within the project as suggested throws this: enter image description here -
Tried removing next folder, node_modules and cache clean with full reinstall of packages (did not do canary install yet) in this post text
Any suggestions on why it’s trying to default to this version that I no longer have on my machine, or how to fix?
2
Answers
Unclear on the causation, but node dependency not added to package.json, when using auto or manual Next.js install methodologies from terminal. Solved by manually adding Node dependency to package.json file of project.
go to the terminal and type
then go to the next js project and find package.json file. Here you need to replace the old node version with the current node version
Delete the node_modules and package-lock.json files then go to the terminal and reinstall dependencies