diff --git a/CSDN博文备份/VitePress项目部署cloudflarepage提示Node构建错误-147155315.md b/CSDN博文备份/VitePress项目部署cloudflarepage提示Node构建错误-147155315.md new file mode 100644 index 0000000..c34b8e3 --- /dev/null +++ b/CSDN博文备份/VitePress项目部署cloudflarepage提示Node构建错误-147155315.md @@ -0,0 +1 @@ +

提示的构建错误信息为:



09:35:29.838	Error: Exit with error code: 1
09:35:29.839 at ChildProcess. (/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 的版本信息。



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


控制台输出:



PS D:\WorkDir\iSharkFly\iSharkFly-Cn\docs-hn> yarn set version stable
➤ YN0000: Downloading https://repo.yarnpkg.com/4.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



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



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

\ No newline at end of file