next": ^14.0.4 and next-auth:beta throwing error Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'node_modules\next\headers' imported from node_modules\next-auth\lib\index.js Did you mean to import next/headers.js? #9385
Replies: 22 comments 18 replies
-
Beta Was this translation helpful? Give feedback.
-
I'm seeing the same thing trying to access /api/auth/providers. "next": "14.0.4", |
Beta Was this translation helpful? Give feedback.
-
I've got two apps using:
but one uses App Router and the other uses the Pages Router. The one using App Router works like a charm. The Pages Router version throws when I try to call
|
Beta Was this translation helpful? Give feedback.
-
"next": "14.0.4", In my case it's an App router. It throws the error only when in the page (or in its child components) is an import connected to next-auth. |
Beta Was this translation helpful? Give feedback.
-
For me it is the signin page. When calling getProviders(), it throws this error. |
Beta Was this translation helpful? Give feedback.
-
any updates? same error using vitest test library |
Beta Was this translation helpful? Give feedback.
-
I also got this error, Cannot find module 'node_modules/next/server' imported from node_modules/next-auth/lib/env.js . |
Beta Was this translation helpful? Give feedback.
-
I got this error too, im using pages dir,
|
Beta Was this translation helpful? Give feedback.
-
Same here: |
Beta Was this translation helpful? Give feedback.
-
Same:
|
Beta Was this translation helpful? Give feedback.
-
did import of auth/core from NPM, didn't help on its own. Ok looks like some naming issues with not finding the .js versions of these files in node_modules node_modules/next-auth/lib/env.js import {NextRequest} from "next/server.js"; -from- node_modules/next-auth/lib/index.js -to- node_modules/next-auth/lib/actions.js -to- after making changes restarting npm run dev I then hit errors with the /api/auth/[...nextauth] but that's different error. |
Beta Was this translation helpful? Give feedback.
-
For me, this was fixed by transpiling {
transpilePackages: ['next-auth'],
} |
Beta Was this translation helpful? Give feedback.
-
This did not fix it for me. I have been fighting this for a few days and am really starting to not like this package anymore. Seems like a pretty big deal if i cannot run the example code. |
Beta Was this translation helpful? Give feedback.
-
Once I personally resolved this I hit other errors and dropped using the beta release and used the v4 mainstream release. I think if you are building anything right now it is probably safer to use that version and worrying about upgrading if needed. Other than rebranding not sure it has that big of a difference once I got my code working. |
Beta Was this translation helpful? Give feedback.
-
Encountered the same issue |
Beta Was this translation helpful? Give feedback.
-
Any news on this issue? I've done the changes of #10304 locally and got it working for me. |
Beta Was this translation helpful? Give feedback.
-
Same issue. |
Beta Was this translation helpful? Give feedback.
-
I have the same issue Error [ERR_MODULE_NOT_FOUND]: Cannot find module '//node_modules/next/server' imported from //node_modules/next-auth/lib/env.js "next": "^14.2.3", |
Beta Was this translation helpful? Give feedback.
-
FYI I have had the same issue, migrating back to NextAuth.js 4 is the only thing that fixed the issue for me. This is completely fair and expected as Auth.js 5 is still in beta. |
Beta Was this translation helpful? Give feedback.
-
The permanent fix seems to be making progress in next.js - vercel/next.js#64529 partially approved. Some other revisions requested 3 days ago for some files to work with JS and TS. Hopefully that's done relatively soon in comparison to how long this has been experienced. |
Beta Was this translation helpful? Give feedback.
-
@sandercoffee @voices-in-tech
|
Beta Was this translation helpful? Give feedback.
-
Not sure what exactly is causing this issue but I recently upgraded from next-auth:^4.24.5 to next-auth:beta and now getting this error:
I would like to know if anyone else is experiencing this issue?
Beta Was this translation helpful? Give feedback.
All reactions