Home  >  Q&A  >  body text

I encountered an `Error: Cannot find module 'react'` error when running `next dev` while setting up vercel/postgres

<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粉004287665P粉004287665403 days ago493

reply all(1)I'll reply

  • P粉773659687

    P粉7736596872023-08-17 16:47:02

    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

    reply
    0
  • Cancelreply