Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

347
Vistas
What is causing this export error when trying to use a NextAuth.js Provider with Next.js?

I'm creating my first project in React/Next.js, using NextAuth.js for Auth-N. I'm loosely following along with the Getting Started guide on the NextAuth website, and I've created a [...nextauth].js page that contains the following code:

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,
        })
    ]
})

I'm using the Provider in a Header.js page that contains the following code:

...
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;

However, when I spin up my site with 'npm run dev' and try to login, I get the following error:

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

I'm using NextAuth 4.0.6 and I don't see a /google specific export mentioned anywhere in the NextAuth package.json locally or on GitHub. Should there be? What am I missing?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

  1. Make sure you have a compatible node version, I'm using 12.22.1.
  2. Check if the [...nextauth].js file name is written correctly.
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda