AI-accounting-soft-uniApp/TROUBLESHOOTING.md
2025-12-12 16:49:06 +08:00

48 lines
1.1 KiB
Markdown
Raw Permalink 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.

# 故障排查指南
## 问题Failed to resolve import "vue"
### 解决方案
1. **确保依赖已安装**
```bash
cd frontend
npm install vue pinia
```
2. **清除缓存并重新安装**
```bash
cd frontend
npm cache clean --force
rm -rf node_modules
npm install
```
3. **在HBuilderX中运行**
- 不要使用命令行运行
- 直接在HBuilderX中运行 → 运行到浏览器
- HBuilderX会自动处理依赖
4. **检查node_modules**
- 确保 `frontend/node_modules/vue` 目录存在
- 如果不存在,执行 `npm install vue`
5. **如果仍然报错**
- 尝试删除 `vite.config.js`HBuilderX项目可能不需要
- 或者简化 `vite.config.js` 配置
## 常见问题
### Q: HBuilderX提示缺少index.html
A: 已创建 `index.html` 文件,如果还有问题,检查文件是否在根目录。
### Q: 依赖安装失败?
A: 对于HBuilderX项目通常不需要手动安装uni-app相关依赖只需要安装业务依赖vue、pinia
### Q: API请求失败
A: 确保后端服务已启动,检查 `utils/request.js` 中的API地址配置。