python config_error ai_generated true

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

django.db.migrations.exceptions.NodeNotFoundError: Migration myapp.0002_auto depends on nonexistent node ('other_app', '0001_initial')

ID: python/pytest-django-migration-test

其他格式: JSON · Markdown 中文 · English
80%修复率
87%置信度
0证据数
2025-11-05首次发现

版本兼容性

版本状态引入弃用备注
3.x active — — —

根因分析

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

English

A migration file references a dependency that doesn't exist. This can happen if the other app is not installed, the migration was deleted, or there's a circular dependency.

generic

解决方案

  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

无效尝试

常见但无效的做法:

  1. 90% 失败

    This may break the migration history and cause other issues.

  2. 85% 失败

    This marks migrations as applied without actually creating tables, leading to database inconsistencies.

  3. 80% 失败

    The app must have its migrations to satisfy the dependency.