Starter Example failed to load.
Unanswered
Polar bear posted this in #help-forum
Polar bearOP
Hi, I'm following the tutorial on the next.js website. there so from the tutorial I'm using starter example.
When I try to run command:
It throws this error:
However when I don't use the starter-example and go with the main command:
How can I resolve the issue with the starter-example?
When I try to run command:
npx create-next-app@latest nextjs-dashboard --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example"It throws this error:
Downloading files from repo https://github.com/vercel/next-learn/tree/main/dashboard/starter-example. This might take a moment.
Installing packages. This might take a couple of minutes.
npm error code ERESOLVE
npm error ERESOLVE unable to resolve dependency tree
npm error
npm error While resolving: undefined@undefined
npm error Found: react@19.0.0-rc-6230622a1a-20240610
npm error node_modules/react
npm error react@"19.0.0-rc-6230622a1a-20240610" from the root project
npm error
npm error Could not resolve dependency:
npm error peer react@">= 16" from @heroicons/react@2.1.3
npm error node_modules/@heroicons/react
npm error @heroicons/react@"^2.0.18" 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
npm error For a full report see:
npm error /home/imtiapy/.npm/_logs/2024-06-11T20_46_55_522Z-eresolve-report.txt
npm error A complete log of this run can be found in: /home/imtiapy/.npm/_logs/2024-06-11T20_46_55_522Z-debug-0.log
Aborting installation.
npm install has failed.However when I don't use the starter-example and go with the main command:
npx create-next-app@latest it runs perfectly and installs the dependency. How can I resolve the issue with the starter-example?
9 Replies
The issue you're encountering is due to a conflict in the dependencies specified in the starter-example from the Next.js tutorial. The specific conflict is between the version of React specified in the example and the version required by @heroicons/react.
Can you try using --legacy-peer-deps (it tells npm to ignore peer depedency conflicts and proceed with the installation). Here is the command:
Can you try using --legacy-peer-deps (it tells npm to ignore peer depedency conflicts and proceed with the installation). Here is the command:
npx create-next-app@latest nextjs-dashboard --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example" --legacy-peer-depsPolar bearOP
I tried with both --legacy-peer-deps and --force flags. Both throws the same error
Polar bearOP
if the conflict is between the version of React specified in the example and the version required by @heroicons/react, I think we can specify the required version React by @heroicons/react in the package.json.
Another point is that, if the purpose of example code to get the learner straight away into learning the core features of Next.JS, why not solving it?
Another point is that, if the purpose of example code to get the learner straight away into learning the core features of Next.JS, why not solving it?
Polar bearOP
I tried removing the @heroicons/react from the package.json and install with npm install.
Still throws the same error
Still throws the same error
Have you tried using yarn instead of npm?
yarn create next-app nextjs-dashboard --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example"Polar bearOP
Great. It's working with yarn
I first copied the example code from the github repo, then run the installation with yarn.
I first copied the example code from the github repo, then run the installation with yarn.
Glad to know that helped!
Himalayan
Same problem when installing via npm. Is npm not supported anymore by the nextjs team?