Don't Let the Default Fool You: Choosing the Right Option When Installing React 19 Packages

Don't Let the Default Fool You: Choosing the Right Option When Installing React 19 Packages
Photo by Andrej Lišakov / Unsplash

If you've recently started a new project with React 19 and tried installing a component library like shadcn/ui, you might have been greeted by a message that looks something like this:

"Some packages may fail to install due to peer dependency issues in npm..."
And then it asks:
How would you like to proceed?Use --forceUse --legacy-peer-deps

Interestingly, --force is selected by default. But does that mean it's the right choice?

Let’s slow down and unpack what’s happening behind the scenes — because picking the wrong option here could set your project up for a lot of invisible pain later on.


🤔 What’s the Real Issue?

React 19 is still very new, and many libraries — including UI frameworks, form utilities, and animation packages — haven’t updated their peer dependencies to officially support it yet.
npm tries to protect you by enforcing those peer dependency checks, but when they fail, you're left with two override options.


🥊 --force vs --legacy-peer-deps

Option 1: --force

This tells npm:

“Just install everything, I don’t care if dependencies are broken or incompatible.”
  • ✅ It works instantly.
  • ❌ But you risk runtime issues, especially with deeply integrated packages like @radix-ui/react-*, tailwind-variants, or anything tightly coupled to React internals.
  • ❌ If you later hit a bug, it's harder to tell whether it's your code… or a broken dependency.

Use this if you're developing a prototype, testing, or you're in full control of the dependency graph.


Option 2: --legacy-peer-deps

This tells npm to install the packages while skipping peer dependency enforcement, like in the npm v6 days.

  • ✅ Safer than --force, because it avoids forcibly overwriting mismatched versions.
  • ✅ Works better if you trust the library (like shadcn/ui) to mostly work with React 19, even if they haven't updated the peer dependency fields yet.
  • ❌ You still need to test, but you’re less likely to hit breaking conflicts.

This is usually the better default if you're unsure.


⚠️ So Why Is --force Preselected?

The CLI tool isn’t trying to trick you — it just displays the first option by default, which often happens to be --force.

But don’t mistake convenience for recommendation.
Think of it as:

"Here’s a way to proceed quickly — but only do this if you know what you're doing."

🔍 A Smarter Way Forward

Before proceeding with either:

  • Check if your library supports React 19 officially.
    For shadcn/ui, you can check here: https://ui.shadcn.com/react-19
  • Watch for community feedback in GitHub issues or Discord channels. Many early adopters share what works or breaks.

✅ TL;DR Recommendations

Situation Best Option
You're experimenting or prototyping --force is fine
You're building for production or collaborating Prefer --legacy-peer-deps
You're unsure and want stability Stick with React 18 until dependencies catch up

🧠 Finally

Just because a CLI prompt highlights --force, doesn’t mean you should blindly accept it.
Modern development is about stability, maintainability, and trust in your stack — so it’s worth taking a moment to make the smarter choice.

Want your project to scale without unexpected surprises?
Then always question the defaults.

Even when they seem convenient.

Support Us