相关疑难解决方法(0)

在 next-auth 中制作自定义电子邮件登录页面时找不到“next-auth/react”模块

我正在制作一个带有 next-auth 的 NextJs 应用程序作为身份验证部分。使用next-auth自己的默认页面成功实现了电子邮件登录。

但现在我想要一个自定义登录页面。我按照文档进行操作,并添加 pages: { signIn: '/auth/signin' }到我的 [...nextauth].js 文件中。然后,我在pages/auth/signin.js中添加了给定的电子邮件登录代码。但在运行时,我收到此模块未找到错误:yarn dev

error - ./pages/api/auth/signin.js:1:0
Module not found: Package path ./react is not exported from package C:\...\node_modules\next-auth (see exports field in C:\...\node_modules\next-auth\package.json)
> 1 | import { getCsrfToken } from "next-auth/react"
  2 | 
  3 | export default function SignIn({ csrfToken }) {
  4 |   return (

Import trace for requested module:

https://nextjs.org/docs/messages/module-not-found
Run Code Online (Sandbox Code Playgroud)

我在 npm 或纱线网站中找不到任何名为“next-auth/react”的模块。即使在node_modules的next-auth文件夹中,也没有“react”命名文件......

我该如何解决这个问题?我在这里做错了什么吗?

npm yarnpkg next.js next-auth

10
推荐指数
3
解决办法
2万
查看次数

标签 统计

next-auth ×1

next.js ×1

npm ×1

yarnpkg ×1