nuxt-auth: './core' is not defined by "exports" in next-auth/package.json
Environment
Nuxi 3.6.5 8:38:19 AM
RootDir: /Users/me/Development/vercel/drclinic-app
Nuxt project info: (copied to clipboard)
- Operating System: Darwin
- Node Version: v16.20.1
- Nuxt Version: 3.6.5
- Nitro Version: 2.4.0
- Package Manager: pnpm@8.6.12
- Builder: vite
- User Config: modules, auth, typescript, gitsUi, devtools, imports, css, i18n, colorMode, vite, experimental
- Runtime Modules: @morpheme/nuxt@1.0.0-beta.11, @nuxtjs/tailwindcss@6.8.0, @nuxtjs/color-mode@3.3.0, @nuxtjs/i18n@8.0.0-beta.10, @sidebase/nuxt-auth@0.6.0-beta.4
- Build Modules: -
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
export default defineNuxtConfig({ modules: [ '@sidebase/nuxt-auth', ], auth: { globalAppMiddleware: true, },
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
✔ Nitro built in 162 ms nitro 8:31:16 AM
[8:31:16 AM] ERROR [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
at new NodeError (node:internal/errors:387:5)
at throwExportsNotFound (node:internal/modules/esm/resolve:365:9)
at packageExportsResolve (node:internal/modules/esm/resolve:649:3)
at packageResolve (node:internal/modules/esm/resolve:833:14)
at moduleResolve (node:internal/modules/esm/resolve:901:20)
at defaultResolve (node:internal/modules/esm/resolve:1115:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:841:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
🙏🏼please help me...
About this issue
- Original URL
- State: closed
- Created 10 months ago
- Reactions: 5
- Comments: 17 (1 by maintainers)
Easiest is to add
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.
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 :
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
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?
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
Me either, nuxt 3.7.1 nuxt-auth 0.5.0 next-auth 4.21.1 works well.
Same for me with
0.5.0
on3.7.0
release of nuxt. Thanks @andreasvirkus, works well for me !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