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

NextJS v15.0.3部署Netlify时Build报错:参数类型无效

NextJS 15.0.3 部署Netlify时「Collecting page data」步骤失败的解决办法

问题现象

部署到Netlify时,构建卡在「Collecting page data」阶段,所有页面报以下错误:

2:25:13 PM: Error: Failed to collect configuration for /
2:25:13 PM:     at <unknown> (/opt/build/repo/node_modules/next/dist/build/utils.js:1131:23)
2:25:13 PM:     at async Span.traceAsyncFn (/opt/build/repo/node_modules/next/dist/trace/trace.js:153:20) {
2:25:13 PM:   [cause]: TypeError: The first argument must be of type string or an instance of Buffer, ArrayBuffer, or Array or an Array-like Object. Received undefined
2:25:13 PM:       at 61978 (/opt/build/repo/.next/server/chunks/633.js:1:12040)
2:25:13 PM:       at t (/opt/build/repo/.next/server/webpack-runtime.js:1:143)
2:25:13 PM:       at 34908 (/opt/build/repo/.next/server/chunks/633.js:1:13151)
2:25:13 PM:       at t (/opt/build/repo/.next/server/webpack-runtime.js:1:143)
2:25:13 PM:       at 638 (/opt/build/repo/.next/server/chunks/633.js:1:8577)
2:25:13 PM:       at Function.t (/opt/build/repo/.next/server/webpack-runtime.js:1:143)
2:25:13 PM:       at async getLayoutOrPageModule (/opt/build/repo/node_modules/next/dist/server/lib/app-dir-module.js:33:15) {
2:25:13 PM:     code: 'ERR_INVALID_ARG_TYPE'
2:25:13 PM:   }
2:25:13 PM: }

示例主页代码:

"use client"

import { Button } from "@/components/Button"

export default function AppPage() {
  const handleClick = () => {}

  return (
    <div className="max-w-5xl m-auto">
      <Button onClick={handleClick}>DO IT</Button>
    </div>
  )
}

排查与解决步骤

  • 检查依赖兼容性:NextJS 15属于新版本,部分第三方组件或自定义工具函数可能未适配。重点排查:自定义组件(比如示例中的Button)是否在渲染时传递了undefined参数;所有页面/组件中是否有把undefined传入要求必须是字符串/Buffer类的API(比如Buffer.from())。
  • 本地复现调试:在本地执行next build,复现相同错误后,打开.next/server/chunks/633.js定位61978函数的代码,找到接收undefined的位置,回溯调用链找到问题源头。
  • 清理缓存重构建:本地删除.next和node_modules,重新安装依赖后构建;同时在Netlify控制台开启「清除缓存并重新部署」选项,避免旧缓存干扰。
  • 检查App Router配置:确认app目录下的页面、布局文件无语法错误,全局布局(layout.js)中是否存在服务端组件调用客户端API、传递未定义参数等异常逻辑。
  • 临时降级版本:如果以上方法无效,可尝试降级到NextJS 14.x稳定版(比如next@14.2.14),排查是否为15.0.3的版本bug。

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 17:43:13