Next.js Discord

Discord Forum

Can't build in Next.js 15

Answered
Atlantic herring posted this in #help-forum
Open in Discord
Atlantic herringOP
If I run the command npm install, I’m getting this error:
# npm resolution error report
While resolving: landing-page@0.1.0
Found: @types/react@18.3.18
node_modules/@types/react
  dev @types/react@"^18.2.47" from the root project
  peer @types/react@"^18.2.47" from @devnomic/marquee@1.0.3
  node_modules/@devnomic/marquee
    @devnomic/marquee@"^1.0.3" from the root project

Could not resolve dependency:
peer @types/react@"^19.0.0" from @types/react-dom@19.0.3
node_modules/@types/react-dom
  dev @types/react-dom@"^19" from the root project


This is my package.json:
  "dependencies": {
    "@devnomic/marquee": "^1.0.3",
    "@hookform/resolvers": "^4.1.0",
    "@radix-ui/react-accordion": "^1.2.3",
    "@radix-ui/react-avatar": "^1.1.3",
    "@radix-ui/react-collapsible": "^1.1.3",
    "@radix-ui/react-dialog": "^1.1.6",
    "@radix-ui/react-label": "^2.1.2",
    "@radix-ui/react-navigation-menu": "^1.2.5",
    "@radix-ui/react-select": "^2.1.6",
    "@radix-ui/react-separator": "^1.1.2",
    "@radix-ui/react-slot": "^1.1.2",
    "@radix-ui/react-tabs": "^1.1.3",
    "@react-email/components": "^0.0.33",
    "@upstash/ratelimit": "^2.0.5",
    "@upstash/redis": "^1.34.4",
    "class-variance-authority": "^0.7.1",
    "clsx": "^2.1.1",
    "embla-carousel-react": "^8.5.2",
    "framer-motion": "^12.4.3",
    "lucide-react": "^0.475.0",
    "next": "15.1.7",
    "next-themes": "^0.4.4",
    "react": "^19.0.0",
    "react-dom": "^19.0.0",
    "react-hook-form": "^7.54.2",
    "resend": "^4.1.2",
    "sonner": "^1.7.4",
    "tailwind-merge": "^3.0.1",
    "tailwindcss-animate": "^1.0.7",
    "zod": "^3.24.2"
  },
  "devDependencies": {
    "@eslint/eslintrc": "^3",
    "@types/node": "^20",
    "@types/react": "^19",
    "@types/react-dom": "^19",
    "eslint": "^9",
    "eslint-config-next": "15.1.7",
    "postcss": "^8",
    "tailwindcss": "^3.4.1",
    "typescript": "^5"
  }
}


I have no idea how to fix this problem properly.
Answered by LuisLl
Some libraries aren't fully supporting or compatible with the latest version of React yet, you need to force the install adding the flag "--legacy-peer-deps"
View full answer

1 Reply

Some libraries aren't fully supporting or compatible with the latest version of React yet, you need to force the install adding the flag "--legacy-peer-deps"
Answer