[SOLVED] Module not found: Can't resolve 'framer-motion'. chakra-ui relation error with moralis 2.0 + NextJS

Hi, I couldn’t find a solution for that yet, anyone has the same problem?

./node_modules/@chakra-ui/checkbox/dist/index.esm.js:106:0
Module not found: Can't resolve 'framer-motion'

Import trace for requested module:
./node_modules/@chakra-ui/react/dist/index.esm.js
./pages/index.jsx

I couldn’t even start my app, because that error blocks the whole initialization.

package.json

{
    "name": "nextjs_demo",
    "version": "1.0.0",
    "main": "index.js",
    "scripts": {
        "dev": "next dev",
        "build": "next build",
        "start": "next start",
        "lint": "next lint"
    },
    "dependencies": {
        "@chakra-ui/react": "^2.2.8",
        "@moralisweb3/evm-utils": "^2.0.3",
        "axios": "^0.27.2",
        "moralis": "2.0.1",
        "next": "^12.2.4",
        "react": "^18.2.0",
        "react-dom": "^18.2.0"
    },
    "devDependencies": {
        "eslint": "^8.22.0",
        "eslint-config-next": "^12.2.5"
    }
}

index.js:

import Main from '../layouts/Main';
import { ThemeProvider, ColorModeProvider } from '@chakra-ui/react';

function Forms() {
  const forms = "<form etc>...";
  return forms;
}

function HomePage() {
  return <>
    <Main>
      <Forms/>
    </Main>
  </>
}

export default HomePage;

What should I follow you’d suggest?

Looks like framer-motion is a required dependency. Try install it

1 Like

tried while it was already installed, same problem.

This issue might be helpful https://github.com/chakra-ui/chakra-ui/issues/3618

1 Like

thank you for your interest. I passed to semantic-ui for now, I will give a chance to a try for chacra. so there is no solution for it for now.

1 Like