You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

安装next-auth 4.24.5后测试出现fetch is not defined错误求助

安装next-auth 4.24.5后测试出现fetch is not defined错误求助

我最近给项目安装了next-auth 4.24.5,结果测试直接崩了,一直弹出fetch is not defined的报错,具体报错栈信息如下:

ReferenceError: fetch is not defined

at Object.clientLogger. [as error] (/node_modules/next-auth/utils/logger.js:99:9)

at _callee$ (/node_modules/next-auth/react/index.js:528:22)

at tryCatch (/node_modules/@babel/runtime/helpers/regeneratorRuntime.js:45:16)

at Generator. (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:133:17)

at Generator.throw (node_modules/@babel/runtime/helpers/regeneratorRuntime.js:74:21)

at asyncGeneratorStep (/home/supertgo/programas/em-cash/wallet.em.cash/simulador-front.em.cash/node_modules/@babel/runtime/helpers/asyncToGenerator.js:3:24)

at _throw (node_modules/@babel/runtime/helpers/asyncToGenerator.js:25:9)

我的项目相关依赖版本如下:

  • jest: "^29.5.0"
  • msw: "^2.0.13"

我已经用上了最新版本的Node,而且觉得这不是Jest的问题——因为我特意换成Vitest试了下,结果还是遇到一模一样的错误。有没有大佬能帮我排查解决这个问题呀?

备注:内容来源于stack exchange,提问作者Thiago Roberto magalhaẽs

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 10:22:56