[bug]: Installation fails with Next.js 15 and/or React 19Β #5557
Description
Describe the bug
While initializing a new Next.js project with shadcn-ui using npx shadcn@latest init
, the installation fails when attempting to install dependencies. The error occurs because @radix-ui/react-icons has a peer dependency requirement for "react@^16.x || ^17.x || ^18.x", but the project is using React 19.0.0-rc-69d4b800-20241021.
Error message:
npm error ERESOLVE unable to resolve dependency tree
npm error Found: react@19.0.0-rc-69d4b800-20241021
npm error Could not resolve dependency:
npm error peer react@"^16.x || ^17.x || ^18.x" from @radix-ui/react-icons@1.3.0
Current environment:
- Next.js 15
- React 19.0.0-rc-69d4b800-20241021
- npm (latest version)
- shadcn-ui (latest version)
The installation works fine with React 18, suggesting that @radix-ui/react-icons needs to be updated to support React 19 release candidates.
Potential solutions:
- Update @radix-ui/react-icons peer dependencies to include React 19
- Add a note in the documentation about React 19 compatibility
- Add a version check in the CLI to warn users about React 19 compatibility issues
Affected component/components
shadcn-ui installation fails
How to reproduce
Steps to reproduce:
1. Create a new Next.js project with experimental features:
```bash
npx create-next-app@latest my-app --typescript --tailwind --app
-
During the setup, select 'yes' for App Router and other default options
-
Navigate to the project directory:
bash
cd my-app -
Try to initialize shadcn-ui:
bash
npx shadcn@latest init -
Select configuration options:
- Style: New York
- Base color: Neutral
- CSS variables: Yes
-
The installation will fail during the dependency installation step with the following error:
npm error ERESOLVE unable to resolve dependency tree
npm error Found: react@19.0.0-rc-69d4b800-20241021
npm error Could not resolve dependency:
npm error peer react@"^16.x || ^17.x || ^18.x" from @radix-ui/react-icons@1.3.0
You can verify the React version in your package.json:
{
"dependencies": {
"react": "19.0.0-rc-69d4b800-20241021",
"react-dom": "19.0.0-rc-69d4b800-20241021"
}
}
Codesandbox/StackBlitz link
No response
Logs
No response
System Info
System Information:
Operating System:
- Windows 8
- Working in Command Prompt
Node Environment:
- Node.js version: v20.17.0
- npm version: v10.9.0
Project Dependencies:
- Next.js: 15
- React: 19.0.0-rc-69d4b800-20241021
- React DOM: 19.0.0-rc-69d4b800-20241021
- Typescript: ^5
- Tailwind CSS: ^3.4.1
CLI Versions:
- create-next-app: latest
- shadcn-ui CLI: latest (@shadcn/ui)
Additional Context:
- Fresh installation with default configurations
- Using App Router
- Project created with TypeScript and Tailwind CSS enabled
Before submitting
- I've made research efforts and searched the documentation
- I've searched for existing issues