Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

345
Views
¿Qué está causando este error de exportación al intentar usar un proveedor de NextAuth.js con Next.js?

Estoy creando mi primer proyecto en React/Next.js, usando NextAuth.js para Auth-N. Estoy siguiendo vagamente la guía de introducción en el sitio web de NextAuth y he creado una página [...nextauth].js que contiene el siguiente código:

 import NextAuth from 'next-auth'; import GoogleProvider from 'next-auth/providers/google'; export default NextAuth({ providers: [ GoogleProvider({ clientId: process.env.GOOGLE_CLIENT_ID, clientSecret: process.env.GOOGLE_CLIENT_SECRET, }) ] })

Estoy usando el proveedor en una página Header.js que contiene el siguiente código:

 ... import {useSession, signIn, signOut} from 'next-auth/react'; const Header = () => { const { data: session } = useSession() ... return ( <header className="border-b border-gray-100 dark:border-gray-700"> <div className="container mx-auto px-4 sm:px-6 py-4 flex justify-between items-center"> <Logo /> <div className={"flex items-center space-x-1 sm:space-x-2"}> {!session ? ( <button type="button" onClick={() => signIn()} className="bg-blue-700 text-white px-4 py-2 rounded-md focus:outline-none focus:ring-4 focus:ring-blue-600 focus:ring-opacity-50 whitespace-nowrap">Sign in</button> ) : ( <button type="button" onClick={() => signOut()} className="bg-blue-700 text-white px-4 py-2 rounded-md focus:outline-none focus:ring-4 focus:ring-blue-600 focus:ring-opacity-50 whitespace-nowrap">Sign out</button> )} </div> </div> </header> ) }; export default Header;

Sin embargo, cuando abro mi sitio con 'npm run dev' e intento iniciar sesión, aparece el siguiente error:

 Server Error Error: Package subpath './providers/google' is not defined by "exports" in /Users/tysont/Workspace/brightnote/node_modules/next-auth/package.json

Estoy usando NextAuth 4.0.6 y no veo una exportación específica de /google mencionada en ninguna parte del paquete NextAuth.json localmente o en GitHub . ¿Debería haber? ¿Qué me estoy perdiendo?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

  1. Asegúrese de tener una versión de nodo compatible, estoy usando 12.22.1.
  2. Compruebe si el nombre del archivo [...nextauth].js está escrito correctamente.
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!