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

Next.js项目报错:Cannot find module 'next/babel' 求解决

问题描述

我知道网上有很多类似的解决方案,但这些方法现在对我都无效,似乎已过时。我对ESLint完全不了解,只是因为它能给未导入/未声明的变量标红才在VS Code中安装了该扩展。

另外,我没有直接在VS Code中打开代码目录,而是打开了包含多个项目的工作区,结构如下:

|  -- some_folder
|     | -- project_1
|     | -- project_2
|     ...files relating to both projects...

全新创建的Next.js项目本不应出现错误,我不知道哪里操作有误。

我的配置文件

.eslintrc.json

{
  "extends": "next"
}

.babelrc

{
  "presets": ["next/babel"],
  "plugins": []
}

已尝试的无效解决方案

  • 在.eslintrc.json中添加next/babel
  • 安装babel-eslint

内容的提问来源于stack exchange,提问作者Tayyab Ferozi

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.04 08:40:47