Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yarn create t3-app crashes with Node 18 (next-auth or @next-auth/prisma-adapter incompatibility?) #59

Closed
c-ehrlich opened this issue Jun 27, 2022 · 7 comments · Fixed by #68
Labels
🐞 confirmed bug Something isn't working

Comments

@c-ehrlich
Copy link
Member

c-ehrlich commented Jun 27, 2022

Describe the bug
When running yarn create t3-app with Node 18, it crashes.
I am not the only person with this issue, see: #57 (comment)

ce-personal@ChristophersAir Documents % yarn create t3-app
yarn create v1.22.17
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
warning "create-t3-app > jscodeshift@0.13.1" has unmet peer dependency "@babel/preset-env@^7.1.6".
[4/4] 🔨  Building fresh packages...
success Installed "create-t3-app@4.0.8" with binaries:
      - create-t3-app
[######################################################################################################] 265/265Welcome to the create-t3-app !
✔ What will your project be called? … node-18-crash
✔ Will you be using JavaScript or TypeScript? › TypeScript
Good choice! Using TypeScript!
✔ Would you like to use Tailwind? … No / Yes
✔ Would you like to use tRPC? … No / Yes
✔ Would you like to use Prisma? … No / Yes
✔ Would you like to use Next Auth? … No / Yes
Scaffolding in: /Users/ce-personal/Documents/node-18-crash...
Using: yarn


node-18-crash scaffolded successfully.

Installing packages...
  Installing tailwind...
  Successfully installed tailwind.
  Installing trpc...
  Successfully installed trpc.
  Installing prisma...
  Successfully installed prisma.
  Installing nextAuth...
Error: Command failed: yarn add  next-auth @next-auth/prisma-adapter
error openid-client@5.1.7: The engine "node" is incompatible with this module. Expected version "^12.19.0 || ^14.15.0 || ^16.13.0". Got "18.4.0"
error Found incompatible module.

    at ChildProcess.exithandler (node:child_process:389:12)
    at ChildProcess.emit (node:events:537:28)
    at maybeClose (node:internal/child_process:1091:16)
    at Socket.<anonymous> (node:internal/child_process:449:11)
    at Socket.emit (node:events:537:28)
    at Pipe.<anonymous> (node:net:747:14) {
  code: 1,
  killed: false,
  signal: null,
  cmd: 'yarn add  next-auth @next-auth/prisma-adapter',
  stdout: 'yarn add v1.22.17\n' +
    '[1/4] Resolving packages...\n' +
    '[2/4] Fetching packages...\n' +
    'info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.\n',
  stderr: 'error openid-client@5.1.7: The engine "node" is incompatible with this module. Expected version "^12.19.0 || ^14.15.0 || ^16.13.0". Got "18.4.0"\n' +
    'error Found incompatible module.\n'
}
✨  Done in 45.85s.

It seems there is an incompatibility between either next-auth or @next-auth/prisma-adapter and node 18?

The app still builds to some extent, and it is possible to run. Here is the console output when running it:

ce-personal@ChristophersAir node-18-crash % yarn dev
yarn run v1.22.17
$ next dev
warn  - Port 3000 is in use, trying 3001 instead.
ready - started server on 0.0.0.0:3001, url: http://localhost:3001

warn - No utility classes were detected in your source files. If this is unexpected, double-check the `content` option in your Tailwind CSS configuration.
warn - https://tailwindcss.com/docs/content-configuration
wait  - compiling...
event - compiled client and server successfully in 914 ms (125 modules)
Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry

To Reproduce
Steps to reproduce the behavior:

  1. Install Node 18
  2. yarn create t3-app, choose defaults (yes) for everything

This is on an M1 MacBook Air running MacOS 12, Yarn 1.22.17, Node 18.4.0

Screenshots
This is a screenshot of the app running after the installer crashed.
image

@c-ehrlich c-ehrlich changed the title yarn create t3-app crashes with Node 18 yarn create t3-app crashes with Node 18 (next-auth or @next-auth/prisma-adapter incompatibility?) Jun 27, 2022
@juliusmarminge
Copy link
Member

seems to be an issue with installing next-auth.

i made some sample apps with some different configs and the ones who crashes are the ones with next-auth.

@juliusmarminge
Copy link
Member

juliusmarminge commented Jun 27, 2022

this error also occurs when installing next-auth into a base next app.

Reroduce

  1. yarn create next-app
  2. yarn add next-auth
  3. The following error will show up: https://app.warp.dev/block/WZbcXk9mGNGompaItsVb11

other packages seems to install fine. using npm and pnpm also works fine.

Setup

CPU: M1 Pro
OS: Mac OS 12.4
Node: 18.4.0
Yarn: 1.22.15

@c-ehrlich
Copy link
Member Author

Seems to be a known issue for next-auth: nextauthjs/next-auth#4575

Their recommendation is using --ignore-engines until nextauthjs/next-auth#4299 is merged.

@nexxeln nexxeln added the 🐞 confirmed bug Something isn't working label Jun 28, 2022
@c-ehrlich
Copy link
Member Author

As far as I see it, there are three possible solutions:

  1. detect if create-t3-app is being run on Node 18, if so tell the user to switch to a compatible version
  • could use process.version [1] or process.versions.node [2] for this
  1. use --ignore-engines
  2. accept this behavior for the time being - do nothing and wait for next-auth to fix this issue (not sure how long it will take, has been open for months now)

[1] https://nodejs.org/docs/latest/api/process.html#processversion
[2] https://nodejs.org/docs/latest/api/process.html#processversions

@juliusmarminge
Copy link
Member

juliusmarminge commented Jun 28, 2022

I vote 1. Simple yet effective to tell people to switch to a supported Node version.

2 would have to make changes to runPkgManagerInstall to support additional flags which seems unnecessary for a bug like this.

EDIT: Proposed warning:
use node lts

@juliusmarminge
Copy link
Member

@nexxeln want a pr or what do you think?

@nexxeln
Copy link
Member

nexxeln commented Jun 28, 2022

Yeah this looks good. I'll merge the PR thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 confirmed bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants