How to install shadcn-ui on latest Next.js beta-RC

By

Installing shadcn/ui on the latest Next.js RC fails over dependencies, so here is how to force it with npx --force shadcn@latest init and add components.

~~~

If you want to setup and use shadcn/ui on the latest Next.js RC (not the stable release), regular setup fails for dependencies issues. The fix is to force the install with npx --force.

At the time of writing, the Next.js release candidate ships with the React 19 RC. That’s the root of the problem.

Why does the regular setup fail?

When you run the shadcn/ui init command, it installs a set of dependencies into your project: the Radix UI primitives the components are built on, Tailwind helpers, and a few utilities.

Many of those packages declare React 18 as their peer dependency. Your RC project uses React 19. npm sees the mismatch, refuses to install, and the setup stops with an ERESOLVE error.

Nothing is actually broken. The packages run fine on the new React. Their package.json just hasn’t been updated yet to say so. This kind of lag is normal during a pre-release period: the ecosystem catches up after the stable release.

The fix

Tell npm to install anyway, by passing --force to npx:

npx --force shadcn@latest init

The flag enables npm’s force mode for the whole run, so the peer dependency conflicts are ignored instead of blocking the install. The init completes normally: it asks its configuration questions, creates the components.json file, and installs what it needs.

You need the same flag every time you add a component:

npx --force shadcn@latest add button

This downloads the button component source into your components folder, ready to import and customize. Swap button for any other component you want.

What are you trading away?

--force skips a safety check. npm stops verifying that the declared peer dependency ranges are satisfied, and installs whatever you asked for.

In my case everything worked fine on the React 19 RC. But if a component misbehaves later, remember the warning you silenced: some dependency might genuinely not support the RC yet.

This is a temporary situation. Once the stable releases ship and the packages update their peer ranges, the flag becomes unnecessary and the plain npx shadcn@latest init works again.

Tagged: Next.js · All topics
~~~

Related posts about next: