BeijingBaby

BeijingBaby

V2EX 第 40195 号会员,加入于 2013-06-05 16:30:09 +08:00
今日活跃度排名 4011
根据 BeijingBaby 的设置,主题列表被隐藏
二手交易 相关的信息,包括已关闭的交易,不会被隐藏
BeijingBaby 最近回复了
openapp.jdmobile://virtual?params={"category":"jump","des":"m","url":"xxxx"}
4 天前
回复了 ccbikai 创建的主题 分享创造 AI 在浏览器内一键去除图片背景
nice !
7 天前
回复了 BeijingBaby 创建的主题 Node.js 莫名环境坏掉了……
@alvinbone88 感谢,确认可复现那确定不是我折腾环境导致的了,估计是在 23 版下有 bug 。
然后我用 22 、20 版本的时候,没有删除.next/cache 导致还是 23 版本的缓存……
7 天前
回复了 BeijingBaby 创建的主题 Node.js 莫名环境坏掉了……
@dcsuibian #8 另外的线索就是
npm run dev 一点问题都没有,只有 build 出错
7 天前
回复了 BeijingBaby 创建的主题 Node.js 莫名环境坏掉了……
@dcsuibian #8

npm info using [email protected]
npm info using [email protected]

同样的,22 、23 版本都试过,一样的错误。

依赖也重新安装过,包括更换为官方镜像。
7 天前
回复了 BeijingBaby 创建的主题 Node.js 莫名环境坏掉了……
@dcsuibian #8

https://github.com/thebetterdev/nextjs-app

正常情况下肯定可以编译成功,这两天可能系统不小心升级了什么导致无法 build 了,比较奇怪,node 不同版本都重装试过了。

以上代码,在我这里
npm run build


> [email protected] build
> next build

▲ Next.js 15.0.3

Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
Collecting page data ..Error: Failed to collect configuration for /
at <unknown> (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/build/utils.js:1131:23)
at async Span.traceAsyncFn (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/trace/trace.js:153:20) {
[cause]: TypeError: e[o] is not a function
at Function.t (/Users/xxxx/Downloads/tt2/my-app/.next/server/webpack-runtime.js:1:127)
at async getLayoutOrPageModule (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/server/lib/app-dir-module.js:37:15)
at async collectAppPageSegments (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/build/segment-config/app/app-segments.js:50:45)
at async (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/build/utils.js:1129:28)
at async Span.traceAsyncFn (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/trace/trace.js:153:20)
}

> Build error occurred
Error: Failed to collect page data for /
at <unknown> (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/build/utils.js:1234:15) {
type: 'Error'
}
7 天前
回复了 BeijingBaby 创建的主题 Node.js 莫名环境坏掉了……
@Plumbiu 是的也降级到 22 或者 20 都尝试过,结果也是有问题的

```

⋊> ~/D/t/my-app on main ⨯ npm run build --verbose 17:34:00
npm verbose cli /opt/homebrew/Cellar/node@20/20.18.0_2/bin/node /opt/homebrew/bin/npm
npm info using [email protected]
npm info using [email protected]
npm verbose title npm run build
npm verbose argv "run" "build" "--loglevel" "verbose"
npm verbose logfile logs-max:10 dir:/Users/xxxx/.npm/_logs/2024-11-15T09_34_06_105Z-
npm verbose logfile /Users/xxxx/.npm/_logs/2024-11-15T09_34_06_105Z-debug-0.log

> [email protected] build
> next build

▲ Next.js 15.0.3

Creating an optimized production build ...
✓ Compiled successfully
✓ Linting and checking validity of types
Collecting page data ..Error: Failed to collect configuration for /
at <unknown> (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/build/utils.js:1131:23)
at async Span.traceAsyncFn (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/trace/trace.js:153:20) {
[cause]: TypeError: e[o] is not a function
at Function.t (/Users/xxxx/Downloads/tt2/my-app/.next/server/webpack-runtime.js:1:127)
at async getLayoutOrPageModule (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/server/lib/app-dir-module.js:37:15)
at async collectAppPageSegments (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/build/segment-config/app/app-segments.js:50:45)
at async (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/build/utils.js:1129:28)
at async Span.traceAsyncFn (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/trace/trace.js:153:20)
}

> Build error occurred
Error: Failed to collect page data for /
at <unknown> (/Users/xxxx/Downloads/tt2/my-app/node_modules/next/dist/build/utils.js:1234:15) {
type: 'Error'
}
npm verbose cwd /Users/xxxx/Downloads/tt2/my-app
npm verbose os Darwin 22.6.0
npm verbose node v20.18.0
npm verbose npm v10.8.2
npm verbose exit 1
```
7 天前
回复了 BeijingBaby 创建的主题 Node.js 莫名环境坏掉了……
@yhl601125163 静态的没有获取数据,比较头疼

@wgbx

@dcsuibian

比较头疼,用不同 node 以及重装 node 都试过了。尝试删除这一个页面的代码,最后精简到:

```
import Image from "next/image";

export default function Home() {
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<Image
aria-hidden
src="/globe.svg"
alt="Globe icon"
width={16}
height={16}
/>
<h1>hello</h1>
</div>
);
}

```

构建成功



```
import Image from "next/image";

export default function Home() {
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<Image
aria-hidden
src="/globe.svg"
alt="Globe icon"
width={16}
height={16}
/>
<h1>中文</h1>
</div>
);
}

```构建失败

就因为有中文,刚开始以为和编码什么的有关系,但是:

```
export default function Home() {
return (
<div className="grid grid-rows-[20px_1fr_20px] items-center justify-items-center min-h-screen p-8 pb-20 gap-16 sm:p-20 font-[family-name:var(--font-geist-sans)]">
<h1>中文</h1>
</div>
);
}
```
构建成功

真不知道啥问题了,估计的重做整个环境。
关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2588 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 10ms · UTC 05:03 · PVG 13:03 · LAX 21:03 · JFK 00:03
Developed with CodeLauncher
♥ Do have faith in what you're doing.