vercel/next-learn

Chapter 1: install failed

vvnab opened this issue ยท 24 comments

npx create-next-app@latest nextjs-dashboard --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example"

npm resolution error report

While resolving: undefined@undefined
Found: react@19.0.0-rc-6230622a1a-20240610
node_modules/react
react@"19.0.0-rc-6230622a1a-20240610" from the root project

Could not resolve dependency:
peer react@">= 16" from @heroicons/react@2.1.3
node_modules/@heroicons/react
@heroicons/react@"^2.0.18" from the root project

Fix the upstream dependency conflict, or retry
this command with --force or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.

learn nextjs from error...

giveup npx create-next-app@latest nextjs-dashboard --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example"

git clone https://github.com/vercel/next-learn/tree/main
cd dashboard/starter-example
pnpm i
pnpm run dev

The issue can be resolved by upgrading the Node.js version to 18.17.0 or higher.

I had the same error. Since the project was downloaded, I tried installing the npm packages with yarn, but I encountered the following error.

โžœ  nextjs-dashboard yarn
yarn install v1.22.19
info No lockfile found.
[1/5] ๐Ÿ”  Validating package.json...
error @: The engine "node" is incompatible with this module. Expected version ">=18.17.0". Got "18.16.1"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

This made me realize there was an issue with the Node.js version. After changing the Node.js version to 20 and reinstalling, the error no longer occurred.

Additionally, the .nvmrc file in this project should be updated to specify the exact version of Node.js required.

Gave up using npm just use bun instead

bun install v1.1.13 (bd6a6051)
warn: incorrect peer dependency "react@19.0.0-rc-6230622a1a-20240610"

warn: incorrect peer dependency "react-dom@19.0.0-rc-6230622a1a-20240610"

warn: incorrect peer dependency "react@19.0.0-rc-6230622a1a-20240610"

+ @types/bcrypt@5.0.2
+ @types/react@18.2.21 (v18.3.3 available)
+ @types/react-dom@18.2.14 (v18.3.0 available)
+ @vercel/style-guide@5.2.0 (v6.0.0 available)
+ dotenv@16.4.5
+ eslint@8.57.0 (v9.4.0 available)
+ eslint-config-next@15.0.0-rc.0
+ eslint-config-prettier@9.0.0 (v9.1.0 available)
+ prettier@3.3.2
+ prettier-plugin-tailwindcss@0.5.4 (v0.6.3 available)
+ @heroicons/react@2.1.3
+ @tailwindcss/forms@0.5.7
+ @types/node@20.5.7 (v20.14.2 available)
+ @vercel/postgres@0.5.1 (v0.8.0 available)
+ autoprefixer@10.4.15 (v10.4.19 available)
+ bcrypt@5.1.1
+ clsx@2.1.1
+ next@15.0.0-rc.0
+ postcss@8.4.31 (v8.4.38 available)
+ react@19.0.0-rc-6230622a1a-20240610
+ react-dom@19.0.0-rc-6230622a1a-20240610
+ tailwindcss@3.3.3 (v3.4.4 available)
+ typescript@5.2.2 (v5.4.5 available)
+ zod@3.23.8

537 packages installed [42.82s]

From last commit 11 jun 2024 Delba de Oliveira changed package.json:

"next": "^14.0.2"               to     "next": "15.0.0-rc.0"
"react": "18.2.0"                to      "react": "19.0.0-rc-6230622a1a-20240610",
"react-dom": "18.2.0"       to       "react-dom": "19.0.0-rc-6230622a1a-20240610"

besides, she changed from npx package manager to pnpm package manager.

So the solution that worked for me was:

  1. Install pnpm from https://pnpm.io/installation
    (If you are in Windows, after intalling remember to log out and log in again so windows path var gets pnpm to work).

  2. Clone from Github

git clone https://github.com/vercel/next-learn

  1. Update your node version, mine is v22.3.0

  2. In /next-learn/dashboard/starter-example/ edit the file .nvmrc and replace the number to your actual node version.

  3. Finally, in power shell or command shell install it with:

pnpm i

pnpm dev

Sin tรญtulo

Remember to install it in In /next-learn/dashboard/starter-example/

There you go! Happy learnning :D

This was just my personal preference, but if you don't want access to the final-example while learning:

  1. Create/navigate the directory you want to clone into.
  2. Clone the repo but don't checkout.
git clone --filter=blob:none --no-checkout https://github.com/vercel/next-learn
  1. Navigate to the cloned but empty repo
cd next-learn/
  1. Create a sparse checkout.
git sparse-checkout set --cone
  1. Select the main branch.
git checkout main
  1. Clone just the starter-example directory.
git sparse-checkout set dashboard/starter-example
  1. Rejoin quecosita's instructions above and update your /dashboard/starter-example/.nvmrc to your current version of node, followed by running pnpm i & pnpm dev

Maybe it would be a great idea - for the future - to not commit release candidate versions to the default branch that is used in production... or at least check if it still works then...

My workaround:
Download or checkout commit b7a4366 which is the commit before it broke.

@AB-xdev 100%. It's bad for NextJS to have potential users become frustrated and have a poor experience because of "broken production." The team at NextJS is very strong, and releasing something half baked shouldn't happen. I send people here often, and just this week I was going through the tutorial myself, to be blocked at square 0.

cc. @rauchg @delbaoliveira

Worked for me

3

cc: QUECOSITA

Worked for me

cc: QUECOSITA

Fixed, but with these warnings/deprecations:
image

Getting this error as well. This problem looks to be created from the recent code merged
https://github.com/vercel/next-learn/pull/743/files

@delbaoliveira @leerob

@blindjedi I had to learn Corepack & pnpm to get things running; corepack enable pnpm, etc. It should be made clear that pnpm is a hard requirement for this to work, which likely throws a lot of us used to other package managers.

You don't need corepack, but we believe pnpm is a better default so we've updated guidance to start here.

Worked for me

The above worked for me, but I am getting a big arrow (heroicon arrow), that I think may have been supposed to be besides log in.
Screenshot 2024-06-16 at 11 12 17โ€ฏPM

I am not sure is it a right way of handling it, but after getting this error during installation, I went to the nextjs-dashboard folder, in the package.json file I changed back dependencies updated in this commit https://github.com/vercel/next-learn/pull/743/files to:

    "next": "^14.0.2",  
    "react": "18.2.0",
    "react-dom": "18.2.0",

And everything worked as expected after that. It is not an ideal solution, but it unblocked me.

PS

pnpm install
pnpm run dev

pnpm fixed the installation failed issue, but I received warning issues with unmet peer dependencies:

Screenshot 2024-06-17 at 10 40 34โ€ฏAM

Worked for me

The above worked for me, but I am getting a big arrow (heroicon arrow), that I think may have been supposed to be besides log in. Screenshot 2024-06-16 at 11 12 17โ€ฏPM

This appears to be intended behavior as the user will soon import the global stylings css file in the next step of the tutorial, fixing the large heroicon arrow.

Several workarounds will end up in the same spot, as the line import '@/app/ui/global.css'; is not included from the /app/layout.tsx file to begin with.

Getting this error as well. This problem looks to be created from the recent code merged https://github.com/vercel/next-learn/pull/743/files

The problem seems to be a react version mismatch.

The @heroicons/react package expects a react version greater than or equal to version 16, but the latest commit (58f9a68) specified an install of react version 19.0.0-rc-6230622a1a-20240610.

According to the semantic versioning documentation, the prerelease candidate tag -rc makes it so that the installed version of react would not satisfy @heroicons/react's react version requirement of >=16, despite it technically being a more recent version.

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

Worked for me

cc: QUECOSITA

Alternatively, you can just replace npx from the original command with pnpm dlx, instead of cloning the repo:

pnpm dlx create-next-app@latest nextjs-dashboard --example "https://github.com/vercel/next-learn/tree/main/dashboard/starter-example"

Worked just fine for me, with no warnings whatsoever:

image

--legacy-peer-deps worked for me
image

From last commit 11 jun 2024 Delba de Oliveira changed package.json:

"next": "^14.0.2"               to     "next": "15.0.0-rc.0"
"react": "18.2.0"                to      "react": "19.0.0-rc-6230622a1a-20240610",
"react-dom": "18.2.0"       to       "react-dom": "19.0.0-rc-6230622a1a-20240610"

besides, she changed from npx package manager to pnpm package manager.

So the solution that worked for me was:

  1. Install pnpm from https://pnpm.io/installation
    (If you are in Windows, after intalling remember to log out and log in again so windows path var gets pnpm to work).
  2. Clone from Github

git clone https://github.com/vercel/next-learn

  1. Update your node version, mine is v22.3.0
  2. In /next-learn/dashboard/starter-example/ edit the file .nvmrc and replace the number to your actual node version.
  3. Finally, in power shell or command shell install it with:

pnpm i

pnpm dev

Sin tรญtulo

Remember to install it in In /next-learn/dashboard/starter-example/

There you go! Happy learnning :D

Thank you! I'm ok using pnpm ๐Ÿ’ฏ

Does using pnpm resolve the issue with importing useActionState hook from react@rc ?

I can run the project as normal after cloning it, but in Chapter 14 of the Learn Next tutorial, it implements this hook which happens to be only available in React Canary and Experimental versions. I get the same error reported in this ticket when trying to update React, React-Dom and Next to the bleeding edge versions just to have access to this hook. Anybody have a workaround?

I'm writing to provide an alternative solution and to hopefully remind the devs for an urgent solution. Take my suggestion below with a kilo of salt as I opened next.js website to learn it but here I am trying to fix things before learning starts.

git clone https://github.com/vercel/next-learn.git
cd next-learn
git reset --hard b7a4366
cd dashboard/starter-example
npm install -g pnpm
pnpm i
pnpm dev