VitePress 项目部署 cloudflare page 提示 Node 构建错误

提示的构建错误信息为:代码语言:javascript代码运行次数:0运行复制09:35:29.838Error: Exit with error code: 109:35:29.839at ChildProcess.<a

VitePress 项目部署 cloudflare page 提示 Node 构建错误

提示的构建错误信息为:

代码语言:javascript代码运行次数:0运行复制
09:35:29.838	Error: Exit with error code: 1
09:35:29.839	    at ChildProcess.<anonymous> (/snapshot/dist/run-build.js)
09:35:29.839	    at Object.onceWrapper (node:events:652:26)
09:35:29.839	    at ChildProcess.emit (node:events:537:28)
09:35:29.840	    at ChildProcess._handle.onexit (node:internal/child_process:291:12)
09:35:29.847	Failed: build command exited with code: 1
2025-04-11_09-42-11

原因和解决

提示上面错误信息的原因是 Yarn 的版本问题。

在默认 NodeJS 的安装情况下,Yarn 会安装 1.22 的版本。

但在cloudflare 构建中,默认会使用 Yarn 3 的版本。

在日志的最上部分,提示了安装 Yarn 的版本信息。

代码语言:javascript代码运行次数:0运行复制
09:35:26.187	No wrangler.toml file found. Continuing.
09:35:26.253	Detected the following tools from environment: yarn@3.6.3, nodejs@18.17.1
2025-04-11_09-43-24

因此解决办法就是针对 VitePress 项目指定使用 yarn 的版本。

运行命令来进行升级:

yarn set version stable

控制台输出:

代码语言:javascript代码运行次数:0运行复制
PS D:\WorkDir\iSharkFly\iSharkFly-Cn\docs-hn> yarn set version stable
➤ YN0000: Downloading .9.1/packages/yarnpkg-cli/bin/yarn.js
➤ YN0000: Saving the new release in .yarn/releases/yarn-4.9.1.cjs
➤ YN0000: Done in 0s 195ms
PS D:\WorkDir\iSharkFly\iSharkFly-Cn\docs-hn> yarn -v
4.9.1
PS D:\WorkDir\iSharkFly\iSharkFly-Cn\docs-hn> 
2025-04-11_09-50-41

随后推送,重新部署即可。

发布者:admin,转转请注明出处:http://www.yc00.com/web/1747727756a4686910.html

相关推荐

  • VitePress 项目部署 cloudflare page 提示 Node 构建错误

    提示的构建错误信息为:代码语言:javascript代码运行次数:0运行复制09:35:29.838Error: Exit with error code: 109:35:29.839at ChildProcess.<a

    1天前
    20

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信