Framer motion error: Module not found: Can't resolve 'react'

I just started a new next.js project and I am trying to use framer motion inside it and on importing motion from framer-motion I get the errror below

 ../node_modules/framer-motion/dist/es/animation/hooks/use-animated-state.mjs:1:0
Module not found: Can't resolve 'react'

https://nextjs.org/docs/messages/module-not-found

here is my import statement

import { motion } from 'framer-motion'

 

message profile
Admin
2023-06-05

This error occurs because React is not installed in your project. To confirm check if react and react-dom are part of your package.json. 

If they are not there then add it like this and run npm install again

{
  "dependencies": {
    "framer-motion": "^10.12.16",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  }
}

 

Add Message

Click on the button below to add a new message to this thread

Tags

#Javascript #next js

Thread detail

Satus: Open
Messages: 1Started: 2023-06-05
loading..

DEVMAESTERS

Newsletter

Services

Frontend Development |Backend Development |Full Website Development |Bootstrap Website upgrades | Website Debbugging | Website Hosting & deployment

Contact

Interested in hiring me or collaborating with me on a project, click on any of the links below to get my social media handle

Or contact me via Tel: (+234)-806-225-7480 | Email: abubakarzakari1703@gmail.com

Copywright@devmaesters.com
Privacy Policy

By using our website,
you agree that devmaesters can store cookies on your device and disclose information in accordance with our privacy policy.