Closed karis closed 1 year ago
Not related to Prisma package, but next-auth
Due to https://github.com/nextauthjs/next-auth/commit/05ff6ae221b0434784e056de4bff6e3e45c49552 fix in https://github.com/nextauthjs/next-auth/releases/tag/next-auth%404.23.0
A solution is to downgrade to next-auth@4.22.5 Or, add manualy into package.json for the next-auth package :
"./core": {
"types": "./core/index.d.ts",
"default": "./core/index.js"
},
I had the same problem and it was solved after the following installation ( example below via yarn )
yarn add next-auth@4.21.1 --legacy-peer-deps
nextauthjs/next-auth@05ff6ae
i already test it, and i got this log..
[10:26:39 PM] AUTH_NO_ORIGIN: No origin - this is an error in production, see https://sidebase.io/nuxt-auth/resources/errors. You can ignore this during development [nitro] [uncaughtException] ReferenceError: require is not defined in ES module scope, you can use import instead 10:26:39 PM at file:///Users/Me/Development/vercel/drclinic-app/.nuxt/dev/index.mjs:1332:26 at ModuleJob.run (node:internal/modules/esm/module_job:192:25) at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24) at async loadESM (node:internal/process/esm_loader:40:7) at async handleMainPromise (node:internal/modules/run_main:66:12)`
Copy it to the nuxt.config.ts file.
export default defineNuxtConfig({ modules: ['@sidebase/nuxt-auth',], auth: { enableGlobalAppMiddleware: true, origin: 'http://localhost:3000', } )
This will only work if you are running on a local host, in other cases I can't vouch that there won't be any errors will be other problems during deploy on static host, so learn to use the .env file in your project.
Easiest is to add
"overrides": {
"next-auth": "4.22.5"
},
to your package.json and to a clean install with npm install
(you may need to delete package-lock.json and node_modules)
Once this issue is fixed, you can simply remove the override.
I was trying just the same but no luck:
still having the following error: WARN (node-resolve plugin) Could not resolve import "next-auth/core"
(i'm using node v18.12.1 with npm namespaces)
Easiest is to add
"overrides": { "next-auth": "4.22.5" },
to your package.json and to a clean install with
npm install
(you may need to delete package-lock.json and node_modules)Once this issue is fixed, you can simply remove the override.
Copy it to the nuxt.config.ts file.
export default defineNuxtConfig({ modules: ['@sidebase/nuxt-auth',], auth: { enableGlobalAppMiddleware: true, origin: 'http://localhost:3000', } )
This will only work if you are running on a local host, in other cases I can't vouch that there won't be any errors will be other problems during deploy on static host, so learn to use the .env file in your project.
still no clue..
i'll check my enviroment again and try to rebuild from scratch..
I finally managed to solve it, I did a reinstall from scratch removing package-lock.json
and using the "next-auth" version: "^4.18.1"
.
Now i'm receiving a 404 from the Github side but this is another problem.
The
"overrides": { "next-auth": "4.22.5" },
workes for me
As others have mentioned, I got rid of the build error by fixing next-auth
to version 4.12.1 (which is the exact version of the peer dependency), it seems anything 4.23.x breaks it?
"dependencies": {
"next-auth": "4.21.1"
}
Just upgraded to "nuxt": "^3.7.0"
and I started getting the same error. I'm using "@sidebase/nuxt-auth": "^0.6.0-beta.4",
. Doing what @dschreij suggested worked for me
Same for me with 0.5.0
on 3.7.0
release of nuxt.
Thanks @andreasvirkus, works well for me !
As others have mentioned, I got rid of the build error by fixing
next-auth
to version 4.12.1 (which is the exact version of the peer dependency), it seems anything 4.23.x breaks it?"dependencies": { "next-auth": "4.21.1" }
Same for me with
0.5.0
on3.7.0
release of nuxt. Thanks @andreasvirkus, works well for me !
Thanks, this one work for me on nuxt
3.7.0
downgrade @sidebase/nuxt-auth
to 0.50
and next-auth
to 4.21.1
Me either, nuxt 3.7.1 nuxt-auth 0.5.0 next-auth 4.21.1 works well.
Not related to Prisma package, but next-auth
Due to nextauthjs/next-auth@05ff6ae fix in https://github.com/nextauthjs/next-auth/releases/tag/next-auth%404.23.0
A solution is to downgrade to next-auth@4.22.5 Or, add manualy into package.json for the next-auth package :
"./core": { "types": "./core/index.d.ts", "default": "./core/index.js" },
hi all,
i already did it, it solved for development. it was running well.
then.. i build run into docker container.
here is what i found
myApp_lite | Error [ERR_MODULE_NOT_FOUND]:
Cannot find module '/app/.output/server/node_modules/next-auth/core/index.js'
imported from /app/.output/server/index.mjs
Duplicate of #514
Not related to Prisma package, but next-auth
Due to nextauthjs/next-auth@05ff6ae fix in https://github.com/nextauthjs/next-auth/releases/tag/next-auth%404.23.0
A solution is to downgrade to next-auth@4.22.5 Or, add manualy into package.json for the next-auth package :
"./core": { "types": "./core/index.d.ts", "default": "./core/index.js" },
Hey @agennari, thanks for this ! Patching next-auth with this did the trick. It seems we're in a deadend here as the maintainer rejected a PR in that direction (https://github.com/nextauthjs/next-auth/pull/8496) @zoey-kaiser will you pin the peerDependency to the latest compatible next-auth i.e. v4.22.5, or what's the plan?
Environment
Nuxi 3.6.5 8:38:19 AM
RootDir: /Users/me/Development/vercel/drclinic-app
Nuxt project info: (copied to clipboard)
Reproduction
it is my first using @sidebase/nuxt-auth i start from scratch
npx nuxi@latest init my-app pnpm i -D @sidebase/nuxt-auth
then configure
nuxt.config.ts
next i install Prisma 5.1.1
then
pnpm run dev
Describe the bug
Error while running project
[worker reload] [worker init] Package subpath './core' is not defined by "exports" in /Users/Me/Development/vercel/drclinic-app/node_modules/next-auth/package.json imported from /Users/Me/Development/vercel/drclinic-app/.nuxt/dev/index.mjs
Additional context
No response
Logs