Skip to main content
imvinojanv.dev
  • About
  • Blog
  • Projects
  • Snippets

Command Palette

Search for a command to run...

imvinojanv.dev
Open to Hire

I'm always open to discussing software engineering work or partnership.

HomeAboutResumeUses
BlogProjectsSnippets
© 2026 Vinojan Veerapathirathasan —— Colombo, Sri Lanka.
MediumGitHubLinkedInRSS
Back

Installing shadcn/ui with Next.js 15 and React 19 Compatibility.

Guide to installing shadcn/ui with Next.js 15 and React 19, addressing common compatibility issues and solutions.

Published on December 22, 2024
4 min read
Installing shadcn/ui with Next.js 15 and React 19 Compatibility.

Hi there 👋,

Welcome back to another enlightening journey into the modern web development landscape. Today, we’re diving deep into the realm of integrating shadcn/ui with the latest Next.js 15 and React 19. 🚀

📑 In this tutorial, we’ll explore how to overcome compatibility challenges and set up shadcn/ui seamlessly with these cutting-edge technologies. Ready to take your projects to the next level? Let’s jump right in! 🎉

The recent release of Next.js 15 and the React 19 marks a major milestone in the web development world. Next.js 15 continues to build on its strengths by introducing performance optimizations, improved support for edge functions, and enhanced development workflows. Meanwhile, React 19 brings a host of exciting updates, including improvements to server components, concurrent rendering enhancements, and the eagerly anticipated React Server Actions.

However, the rapid evolution of these tools can pose challenges. Many popular npm packages rely on peer dependencies, which are specific versions of libraries like React. With React 19 being a release candidate, some packages have yet to update their peer dependencies, leading to compatibility issues during installation. ⚠️

Common Compatibility Issues

Compatibility problems arise when packages enforce strict version requirements for React. For instance, trying to use React 19 with a package that only supports React 18 can result in errors like:

npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: my-app@0.1.0
npm error Found: react@19.0.0-rc-69d4b800-20241021
npm error node_modules/react
npm error   react@"19.0.0-rc-69d4b800-20241021" from the root project

These errors can be frustrating, especially when exploring the latest features of Next.js and React.

Installation Strategies (Solutions)

Option 1: Force Installation

To bypass dependency warnings, you can use the following flags:

npm i <package> --force
# or
npm i <package> --legacy-peer-deps

These flags tell npm to ignore peer dependency warnings and install the package anyway.

Option 2: Temporary Downgrade

If you’re not ready to address compatibility issues, you can temporarily downgrade to React 18:

npm i react@18 react-dom@18

This ensures compatibility with most packages until they update their peer dependencies.

Standard Installation

If you’re using pnpm, bun, or yarn, the standard shadcn/ui installation guide works without extra flags. For npm users, follow these steps:

  1. Run the initialization command:
npx shadcn@latest init
  1. During the process, you’ll be prompted to handle peer dependency issues. Choose one of the following:
It looks like you are using React 19.
Some packages may fail to install due to peer dependency issues.
 
? How would you like to proceed? › - Use arrow-keys. Return to submit.
>   Use --force
    Use --legacy-peer-deps
  1. Select your preferred option, and the CLI will take care of the rest.

Component Compatibility

To ease your setup, here’s a compatibility matrix for shadcn/ui dependencies:

✅ Fully Compatible:

  • radix-ui
  • lucide-react
  • class-variance-authority
  • tailwindcss-animate
  • embla-carousel-react
  • recharts
  • react-hook-form
  • react-resizable-panels
  • sonner
  • react-day-picker
  • input-otp
  • vaul

🚧 Requires Flags:

  • @radix-ui/react-icons (pending PR for React 19 compatibility)

Special Case: recharts

If you use recharts, override its react-is dependency in your package.json:

package.json
"overrides": {
  "react-is": "^19.0.0-rc-69d4b800-20241021"
}

Wrapping Up

Transitioning to Next.js 15 and React 19 is a significant step forward in modern web development. While compatibility issues may arise, they are temporary and manageable. By following the strategies explained above, you can.

Remember, the ecosystem evolves rapidly, and library maintainers are working diligently to ensure compatibility. Stay informed, test thoroughly, and embrace the power of modern web tools to push the boundaries of what’s possible. Happy coding! 🚀


I appreciate you taking the time to read this article.🙌

Before you move on to explore the next article, don’t forget to give your claps 👏 for this article and share with your friends. Stay connected with me on social media. Thanks for your support and have a great rest of your day! 🎊

✍️ Vinojan Veerapathirathasan.

0
0
0
0
0

On This Page

Common Compatibility IssuesInstallation Strategies (Solutions)Option 1: Force InstallationOption 2: Temporary DowngradeStandard InstallationComponent CompatibilitySpecial Case: recharts
Last updated: December 22, 2024