nextauthjs / next-auth

Authentication for the Web.
https://authjs.dev
ISC License
23.78k stars 3.27k forks source link

Sveltekit Auth example repo import/runtime error (Failed to resolve entry for package "@auth/sveltekit") #6161

Closed Fermain closed 1 year ago

Fermain commented 1 year ago

Environment

System: OS: macOS 12.4 CPU: (10) arm64 Apple M1 Pro Memory: 155.72 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm Browsers: Chrome: 108.0.5359.124 Safari: 15.5

Reproduction URL

https://github.com/nextauthjs/sveltekit-auth-example

Describe the issue

Attempting to run the sveltekit-auth-example template results in a runtime error:

Failed to resolve entry for package "@auth/sveltekit". The package may have incorrect main/module/exports specified in its package.json.

And errors in the IDE warning of the same issue:

Cannot find module '@auth/sveltekit' or its corresponding type declarations.ts(2307)
Cannot find module '@auth/core/providers/github' or its corresponding type declarations. ts(2307)

How to reproduce

  1. Clone the repo: https://github.com/nextauthjs/sveltekit-auth-example
  2. Install with npm i
  3. Run with npm run dev

Expected behavior

Import resolution is successful

jijamik commented 1 year ago

Same error on Windows 10 and Ubuntu 20.04. It's seems like it's not building, when you manually build @auth/sveltekit you will get a client.js and a index.js that you can use. However same problem for "@auth/core" and i didn't manage to build it.

Edit: it work with npm i @auth/core@0.1.4 and npm i @auth/sveltekit@0.1.6

machak commented 1 year ago

same error on linux (pnpn)

cyco130 commented 1 year ago

It seems that this happens because @auth/core@0.2.1 has been published without building first: https://www.npmjs.com/package/@auth/core/v/0.2.1?activeTab=explore

oofdere commented 1 year ago

Getting the same error on arch linux w/ both yarn and npm. This also seems to have happened to @auth/sveltekit, as shown when downgrading only core:

Error: Failed to resolve entry for package "@auth/sveltekit". The package may have incorrect main/module/exports specified in its package.json.
    at packageEntryFailure (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:21822:11)
    at resolvePackageEntry (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:21819:5)
    at tryNodeResolve (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:21557:20)
    at Context.resolveId (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:21321:28)
    at Object.resolveId (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:41407:46)
    at async TransformContext.resolve (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:41154:23)
    at async normalizeUrl (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:39506:34)
    at async TransformContext.transform (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:39647:47)
    at async Object.transform (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:41480:30)
    at async loadAndTransform (file:///home/teo/gasp/node_modules/vite/dist/node/chunks/dep-0bae2027.js:39287:29)

Additionally can't build manually because npm can't find tsconfig@0.0.0 apparently.

npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@next-auth%2ftsconfig - Not found
npm ERR! 404 
npm ERR! 404  '@next-auth/tsconfig@0.0.0' is not in this registry.
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.

Just downgraded to previous version for now.

balazsorban44 commented 1 year ago

This is correct: https://github.com/nextauthjs/next-auth/issues/6161#issuecomment-1364346790

Will be fixed in the upcoming release.

balazsorban44 commented 1 year ago

Should be fixed in @auth/sveltekit@0.1.9

biscotty666 commented 1 year ago

I am experiencing this problem with

        "@supabase/auth-ui-shared": "^0.1.6",
        "@supabase/auth-ui-svelte": "^0.2.2"
dashaomai commented 1 year ago

I am experiencing this problem with

      "@supabase/auth-ui-shared": "^0.1.6",
      "@supabase/auth-ui-svelte": "^0.2.2"

I meet this too