From 026b043eccac6db50f8d567aa07d097c6d488013 Mon Sep 17 00:00:00 2001 From: huyuchengus Date: Fri, 11 Apr 2025 22:31:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=BD=E5=8D=9A=E6=96=87=E5=86=85?= =?UTF-8?q?=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VitePress项目部署cloudflarepage提示npmrunbuild错误-147155490.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 CSDN博文备份/VitePress项目部署cloudflarepage提示npmrunbuild错误-147155490.md diff --git a/CSDN博文备份/VitePress项目部署cloudflarepage提示npmrunbuild错误-147155490.md b/CSDN博文备份/VitePress项目部署cloudflarepage提示npmrunbuild错误-147155490.md new file mode 100644 index 0000000..d8c4fde --- /dev/null +++ b/CSDN博文备份/VitePress项目部署cloudflarepage提示npmrunbuild错误-147155490.md @@ -0,0 +1 @@ +

构建的错误信息如下:



09:52:57.975	➤ YN0000: · Done with warnings in 3s 120ms
09:52:58.072 Executing user command: npm run build
09:52:58.817 npm ERR! Missing script: "build"
09:52:58.818 npm ERR!
09:52:58.818 npm ERR! To see a list of scripts, run:
09:52:58.818 npm ERR! npm run
09:52:58.818
09:52:58.819 npm ERR! A complete log of this run can be found in: /opt/buildhome/.npm/_logs/2025-04-10T13_52_58_752Z-debug-0.log
09:52:58.825 Failed: Error while executing user command. Exited with error code: 1



2025-04-11_10-26-25



问题和解决


上面的问题是在执行构建的时候 VitePress 的构建命令不是 npm run build。


这个构建命令需要改成:npm run docs:build


在 cloudflare page 中选择构建配置。




2025-04-11_10-27-32



然后单击编辑按钮, 有 2 个地方要修改。




2025-04-11_10-28-14



一个是构建的命令,一个是构建完成后输出文件夹的路径。


如果dist 文件夹的路径不修改,后面会提示部署找不到需要部署的文件。



https://www.isharkfly.com/t/vitepress-cloudflare-page-npm-run-build/17166https://www.isharkfly.com/t/vitepress-cloudflare-page-npm-run-build/17166

\ No newline at end of file