Next.js Discord

Discord Forum

Unable to install packages with Nextjs 15

Answered
Barbary Lion posted this in #help-forum
Open in Discord
Avatar
Barbary LionOP
To Reproduce

1. Create new nextjs app -> npx create-next-app; Select all the defaults.
2. Try to npm install @headlessui/react or tailwindcss-animate or just npx shadcn init (select defaults)

Current vs Expected Behavior:
# Error Log:
Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

Command failed with exit code 1: npm install tailwindcss-animate class-variance-authority lucide-react @radix-ui/react-icons clsx tailwind-merge
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: new-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
npm error
npm error Could not resolve dependency:
npm error peer react@"^16.x ^17.x ^18.x" from @radix-ui/react-icons@1.3.0
npm error node_modules/@radix-ui/react-icons
npm error @radix-ui/react-icons@"*" from the root project
npm error
npm error Fix the upstream dependency conflict, or retry
npm error this command with --force or --legacy-peer-deps
npm error to accept an incorrect (and potentially broken) dependency resolution.
npm error
npm error

# Expected Behavior

Packages should install as expected.


# Environment Information:
Node.js v22.9.0

Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 24.2.0: Tue Oct 15 18:15:36 PDT 2024; root:xnu-11215.60.364.501.5~3/RELEASE_ARM64_T6000
Available memory (MB): 16384
Available CPU cores: 8
Binaries:
Node: 22.9.0
npm: 10.8.3
Yarn: 1.22.22
pnpm: N/A
Relevant Packages:
next: 15.0.1 // Latest available version is detected (15.0.1).
eslint-config-next: N/A
react: 19.0.0-rc-69d4b800-20241021
react-dom: 19.0.0-rc-69d4b800-20241021
typescript: 5.6.3
Next.js Config:
output: N/A
Answered by Asian black bear
This isn't the GitHub issues page where you should report bugs instead.

Also this is just a peer dependency issue, pretty much none of the React ecosystem has listed the RC version of React in their peer dependencies so you will have to use --legacy-peer-deps or --force just like the npm error told you to.
View full answer

7 Replies

Avatar
Asian black bear
This isn't the GitHub issues page where you should report bugs instead.

Also this is just a peer dependency issue, pretty much none of the React ecosystem has listed the RC version of React in their peer dependencies so you will have to use --legacy-peer-deps or --force just like the npm error told you to.
Answer
Avatar
Barbary LionOP
Appreciate it. Just noticed that a lot of packages that were supported with next and react dependencies associated with 14 don't work with 15 and thought it was a larger issue related to react rc compatibility with older package versions
Avatar
Asian black bear
It doesn't mean that the packages are no longer compatible, it just means that the original authors of the other packages haven't explicitly added the RC as a peer dep saying "yes, we do intend to support the RC with the current version". This is most notably due to the RC being, well ... an RC and not a conventional major and stable version. Realistically most packages will still work, only those that use certain changed or deprecated React 18 features that are different in React 19 will have issues, but those are only very few.
Avatar
Barbary LionOP
Thanks! I also checked next docs and it seems like next 15 has been battle tested across many scenarios and it's likely just what you mentioned. Will just use --legacy-peer-deps ; Just wish upgrading to a major stable release made major functionality work as they previously did (atleast basic stuff like installing packages), wish they wouldve stuck with react 18 and then did a better upgrade.

Out of curiosity, At Jetbrains if you use Next, have you upgraded to 15 in prod?
Avatar
Asian black bear
We don't use Next and in any big corporate setting you'd wait with major updates for a significant amount of time.
Avatar
Def second this. Im toying around with upgrading... but definitely not in the cards till react 19 rc comes out of rc and I have determined that everything works.
plus still waiting probably 6 months regardless of if react19 releases tomorrow.