搭建个人 Docker Registry 代理与客户端配置指南
VitePress 服务器部署与 Git 同步踩坑记录

好的,我帮你整理一篇文章草稿,总结你在 VitePress 服务器部署 + Git 同步 + 构建 过程中踩过的坑,以及 Git 操作经验。文章内容分条清晰,方便你存档和以后查阅。


VitePress 服务器部署与 Git 同步踩坑记录

1. 环境与版本

  • 服务器系统:Ubuntu / Debian
  • Node.js:v24.11.0(注意不要用低版本,VitePress 2.x 需要 >=18)
  • Yarn:1.22.x
  • VitePress:v1.6.x 或 v2.x

注意:低版本 Node 安装 VitePress 会报错:

globby@14.1.0: The engine "node" is incompatible with this module. Expected version ">=18". Got "14.17.6"

2. 服务器部署流程

  1. 创建项目目录:
mkdir /www/wwwroot/vitepress
cd /www/wwwroot/vitepress
  1. 初始化 Node 项目并安装 VitePress:
yarn init -y
yarn add -D vitepress
  1. 创建必要文件:
index.md
markdown-examples.md
api-examples.md
.vitepress/config.mts
  1. 配置 Nginx 指向 .vitepress/dist 目录,使用 location / 访问 VitePress 站点。
  2. 构建 VitePress:
yarn vitepress build

  • 之前使用 VuePress 命令构建,报错 The bundler or theme option is missing,解决方法:确认使用 VitePress 而不是 VuePress。
  • 构建时 .user.ini 文件权限问题会报 EPERM,解决方法:确保构建目录可写,或清理旧文件:
rm -rf .vitepress/dist/*

3. 本地同步与服务器操作

使用 rsync 同步

本地修改后,可以通过 rsync 同步到服务器:

rsync -avz --exclude 'node_modules' --exclude '.vitepress/dist' ./ user@server:/www/wwwroot/vitepress/

排除目录

  • node_modules/
  • .vitepress/dist/(构建产物,无需同步)
  • 可按需排除 .cache 或日志文件

构建流程

在服务器上:

cd /www/wwwroot/vitepress
yarn vitepress build

生成静态文件在 .vitepress/dist/,Nginx 指向此目录即可访问。


版权声明

本网站名称:个人知识记录
本文链接:https://isrv.cn/docker-registry/
本网站的文章部分内容可能来源于网络,仅供学习与参考,如有侵权,请联系站长进行核实删除。
转载本站文章需要遵守:商业转载请联系站长,非商业转载请注明出处并附带原文链接!!!
暂无评论

发送评论 编辑评论


				
|´・ω・)ノ
ヾ(≧∇≦*)ゝ
(☆ω☆)
(╯‵□′)╯︵┴─┴
 ̄﹃ ̄
(/ω\)
∠( ᐛ 」∠)_
(๑•̀ㅁ•́ฅ)
→_→
୧(๑•̀⌄•́๑)૭
٩(ˊᗜˋ*)و
(ノ°ο°)ノ
(´இ皿இ`)
⌇●﹏●⌇
(ฅ´ω`ฅ)
(╯°A°)╯︵○○○
φ( ̄∇ ̄o)
ヾ(´・ ・`。)ノ"
( ง ᵒ̌皿ᵒ̌)ง⁼³₌₃
(ó﹏ò。)
Σ(っ °Д °;)っ
( ,,´・ω・)ノ"(´っω・`。)
╮(╯▽╰)╭
o(*////▽////*)q
>﹏<
( ๑´•ω•) "(ㆆᴗㆆ)
😂
😀
😅
😊
🙂
🙃
😌
😍
😘
😜
😝
😏
😒
🙄
😳
😡
😔
😫
😱
😭
💩
👻
🙌
🖕
👍
👫
👬
👭
🌚
🌝
🙈
💊
😶
🙏
🍦
🍉
😣
Source: github.com/k4yt3x/flowerhd
颜文字
Emoji
小恐龙
花!
上一篇
下一篇