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

接入Million Lint后Next.js开发环境出现构建缓存损坏错误

版本信息
Next.JS: 14.2.3
React: ^18
NodeJS: 23.3.0/win11/arm64

问题描述

我最近发现一款可优化React代码的linter工具Million Lint,打算接入我的Next.js项目。按照官方快速开始文档,执行了命令:

npx million@latest

工具安装完成后自动修改了next.config.mjs文件,但启动本地开发服务器时出现错误:

⚠ Internal Error: Your build cache files are corrupted and has been reset. Please restart your dev server.

完整控制台日志:

vladi@vlud CLANGARM64 ~/Documents/code/rest/million/reproducible_example (master)
$ npm run dev

> reproducible_example@0.1.0 dev
> next dev

(node:7096) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
  ▲ Next.js 14.2.3
  - Local:        http://localhost:3000

 ✓ Starting...
(node:10536) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)

 ⚡ Million Lint v1.0.12
 ✓ Ready in 0.29ms

 ✓ Ready in 2.6s
 ○ Compiling / ...

warn - The `content` option in your Tailwind CSS configuration is missing or empty.
warn - Configure your content sources or your generated CSS will be missing styles.
warn - https://tailwindcss.com/docs/content-configuration
 ✓ Compiled / in 2.2s (504 modules)
 GET / 200 in 2291ms
 ⚠ Internal Error: Your build cache files are corrupted and has been reset. Please restart your dev server.


vladi@vlud CLANGARM64 ~/Documents/code/rest/million/reproducible_example (master)

这个问题在全新的next.js#14.2.3项目中可复现,相关代码如下:

page.tsx:

"use client";

import { useState } from "react";

export default function Home() {
   const [count, setCount] = useState<number>(0);

   const increase = () => {
      setCount(count + 1);
   };

   const decrease = () => {
      setCount(count - 1);
   };

   return (
      <main>
         <button onClick={increase}>+</button>
         <p>{count}</p>
         <button onClick={decrease}>-</button>
      </main>
   );
}

next.config.mjs:

import MillionLint from "@million/lint";
/** @type {import('next').NextConfig} */
const nextConfig = {};

export default MillionLint.next({
   enabled: true,
   rsc: true,
})(nextConfig);

解决方案

针对这个Million Lint接入Next.js 14.2.3后出现的缓存错误,试试以下几个步骤:

  1. 手动清理Next.js缓存
    停止开发服务器,删除项目根目录下的.next文件夹,然后重新启动服务器:

    rm -rf .next
    npm run dev
    

    Windows系统可使用:

    Remove-Item -Recurse -Force .next
    npm run dev
    
  2. 降级Node.js版本
    你当前使用的Node.js 23是预览版,可能存在兼容性问题。建议降级到LTS版本(比如20.x),重新安装依赖后再启动项目。

  3. 调整Million Lint配置
    尝试关闭RSC选项,修改next.config.mjs:

    import MillionLint from "@million/lint";
    /** @type {import('next').NextConfig} */
    const nextConfig = {};
    
    export default MillionLint.next({
       enabled: true,
       rsc: false, // 关闭RSC
    })(nextConfig);
    

    保存后重启服务器,观察是否还会报错。

  4. 重新安装Million Lint
    先卸载现有包,再重新安装最新版本:

    npm uninstall @million/lint
    npm install @million/lint@latest
    

    之后重新运行初始化命令:

    npx million@latest
    

如果以上方法都无效,可以暂时禁用Million Lint,等待官方修复该兼容性问题——毕竟Million Lint v1.0.12与Next.js 14.2.3可能存在适配bug。


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.16 01:57:16