# django.db.migrations.exceptions.NodeNotFoundError: 迁移 myapp.0002_auto 依赖于不存在的节点 ('other_app', '0001_initial')

- **ID:** `python/pytest-django-migration-test`
- **领域:** python
- **类别:** config_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

迁移文件引用了不存在的依赖项。这可能发生在其他应用未安装、迁移被删除或存在循环依赖时。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 3.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Check INSTALLED_APPS and run makemigrations for missing apps.
   ```
2. **** (90% 成功率)
   ```
   Edit the migration's dependencies list to reference the correct app and migration.
   ```
3. **** (80% 成功率)
   ```
   python manage.py migrate --fake-initial
   ```

## 无效尝试

- **** — This may break the migration history and cause other issues. (90% 失败率)
- **** — This marks migrations as applied without actually creating tables, leading to database inconsistencies. (85% 失败率)
- **** — The app must have its migrations to satisfy the dependency. (80% 失败率)
