I am currently building out a basic nextjs website with the help of their handy typescript starter. Everything has been running smooth while developing using yarn dev
until about 20 minutes ago, when I started randomly getting an error message any time I try to run yarn dev
.
This is the error ouput:
It looks like you're trying to use TypeScript but do not have the required package(s) installed.
Please install @types/react by running:
yarn add --dev @types/react
This just randomly started happening with no changes made to the codebase. I've tried wiping node_modules completely and reinstalling, and even tried cleaning the yarn cache. The dependency "@types/react": "^18.0.2"
is included correctly in my package.json's devDependencies
object, so I am totally clueless on how to fix this.
P.S. I found an existing issue posted about this here, but it is not related to my issue at all, as it pertains to Docker. All I am doing is running next.js locally on my laptop, it is not running in production anywhere.
CodePudding user response:
This appears to be an issue with the @types/react package itself, which was just updated to 18.0.2 the morning that you ran into this problem. Rolling back to 18.0.1 appears to work.
CodePudding user response:
The package create-next-app
has been updated!
Use: npx create-next-app@latest my-app --typescript
This works for me now ;)