I encountered an `Error: Cannot find module 'react'` error when running `next dev` while setting up vercel/postgres
P粉004287665
P粉004287665 2023-08-16 17:07:07
0
1
560
<p>I'm trying to create a table in @vercel/postgres database. The Quick Start Guide document at the link below shows how to create the table and states that you need to run the <code>next dev</code> command. But on the terminal I get the following response: </p> <blockquote> <p><em>Cannot find module 'react'. Next.js requires you to include it in 'dependencies' in 'package.json'</em></p> </blockquote> <blockquote> <p><em>throw err;</em> ^</p> </blockquote> <blockquote> <p><em>Error: module 'react' not found</em> ... code: 'MODULE_NOT_FOUND',*</p> </blockquote> <p>I have installed react and react-dom in my package.json file. </p> <p>I tried deleting node_modules and package_lock.json and then running npm install, but the problem is still not resolved. I'm using node.js version 18.17.1. </p> <p>Can anyone help? </p>
P粉004287665
P粉004287665

reply all(1)
P粉773659687

Check your package.json file. If all your libraries are installed, try clearing the cache:

npm cache clean --force

Then install the dependencies using the following command:

npm i

Then it should run

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template