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'
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"
}
}
Similar Content
- Error Next.JS Prisma client not picking up new models
- Error: Invalid `prisma.model.findMany()` invocation. Query engine library for current platform "debian-openssl-1.1.x" could not be found.
- Error Cannot find module 'react-dom/client' or its corresponding type declarations
- Error: React Hook "useEffect" is called conditionally. React Hooks must be called in the exact same order in every component render. react-hooks/rules-of-hooks
- How to Dynamically Update URL Query Parameters in Next.js 13
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.