Files
asset-homepage/DEV-GUIDE.md
2026-01-28 17:55:01 +08:00

63 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 开发指南
## 启动开发服务器
### 自动端口选择
```bash
npm run dev
```
脚本会自动尝试以下端口:
- 3002 (默认)
- 3003
- 3004
- 3005
- 3006
如果以上端口都被占用会随机选择一个3000-4000之间的端口。
### 结束所有开发进程
如果遇到端口占用问题,可以运行:
```bash
npm run dev:kill
```
这会清理所有正在运行的Next.js开发服务器。
然后再运行:
```bash
npm run dev
```
## 其他命令
### 构建生产版本
```bash
npm run build
```
### 启动生产服务器
```bash
npm run start
```
### 代码检查
```bash
npm run lint
```
## 常见问题
**Q: 端口被占用怎么办?**
A: 直接运行 `npm run dev`,脚本会自动找到可用端口。如果还是不行,先运行 `npm run dev:kill` 清理进程。
**Q: 如何查看当前使用的端口?**
A: 启动时会显示 "🚀 Starting dev server on port XXXX"
**Q: 如何强制使用特定端口?**
A: 直接运行:
```bash
npx next dev -H 0.0.0.0 -p 3002
```