docs: 完善安装指南并增强启动脚本功能

- 扩展 README.md 中的安装说明,增加环境要求、详细步骤和常见问题排查
- 重写 start.bat 脚本,支持参数化配置并添加多重回退机制
- 优化开发服务器启动流程,提升不同环境下的兼容性
This commit is contained in:
祀梦
2025-10-22 16:26:29 +08:00
parent d7d342fd55
commit 5dba6ac5b4
2 changed files with 95 additions and 5 deletions

View File

@@ -22,11 +22,43 @@
## 安装
确保您的 Node.js 版本符合要求(^20.6.0 || >=22.0.0),然后执行以下命令
- 环境要求
- Node.js`^20.6.0``>=22.0.0`(推荐使用当前 LTS 或稳定版)
- npm`>=10`
```sh
npm i
```
- 安装步骤:
1. 在项目根目录执行依赖安装:
```sh
npm install
```
2. 启动开发服务器(任选其一):
- 常规方式:
```sh
npm run docs:dev
```
- Windows 快捷方式(尝试监听 `0.0.0.0` 以便局域网访问):
```bat
.\start.bat
```
- 若端口或权限受限,使用备用命令(绑定到本机并更换端口):
```sh
npx vuepress@2.0.0-rc.24 dev docs --port 5173 --host localhost
```
3. 打开浏览器访问:
- `http://localhost:4567/`(默认)或
- `http://localhost:5173/`(如果使用备用命令)
- 常见问题与排查:
- “`vuepress` 不是内部或外部命令”:通常为依赖未安装或安装失败,执行 `npm install` 后重试。
- “listen EACCES: permission denied 0.0.0.0:4567”端口或绑定权限受限改用 `--host localhost` 或更换端口(如 `--port 5173`)。
- 需要清理缓存后重试:
```sh
npm run docs:dev-clean
```
- 更换端口示例(以 8080 为例):
```sh
npx vuepress dev docs --port 8080 --host localhost
```
## 使用