You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Wagtail项目执行makemigrations报NodeNotFoundError问题求助

Fixing NodeNotFoundError for Wagtail Migration Dependency

Got it, let's break down how to fix this migration error you're hitting. Here's what's going on: your custom migration named collection-name is referencing an old Wagtail core migration (wagtailcore.0029_unicode_slugfield_dj19) that no longer exists in your current Wagtail version. When you try removing that dependency, other Wagtail-related migrations (like wagtailimages) break because they rely on proper Wagtail core migration state.

Let's fix this step by step:

1. Confirm your current Wagtail version

First, check which version of Wagtail you're running—this old migration was part of much older Wagtail releases (think 1.x or early 2.x):

python3 manage.py wagtail --version

2. Inspect your problematic migration file

Locate the collection-name migration file in your app's migrations folder (e.g., your_app/migrations/XXXX_collection-name.py). Open it and look for the dependencies section—it should have a line like:

dependencies = [
    ('wagtailcore', '0029_unicode_slugfield_dj19'),
    # Other dependencies...
]

3. Update the Wagtail core dependency to a valid migration

You need to replace that outdated wagtailcore migration reference with the latest applied wagtailcore migration in your project:

  • Run this command to see all wagtailcore migrations and their status:
    python3 manage.py showmigrations wagtailcore
    
  • Look for the last migration marked as [X] (already applied). For example, if your latest applied migration is 0070_purge_revisions, update the dependency line to:
    ('wagtailcore', '0070_purge_revisions'),
    

If you're getting errors with wagtailimages or other Wagtail apps, repeat the same process for those:

  • Run python3 manage.py showmigrations wagtailimages to find the latest applied migration for that app.
  • Update any outdated references in your collection-name migration's dependencies to match the valid, applied migration numbers.

5. Verify and re-run migrations

Once you've updated all dependencies:

  • First, check for any remaining issues with:
    python3 manage.py makemigrations --check
    
  • If no errors are reported, run your migrations normally:
    python3 manage.py makemigrations
    python3 manage.py migrate
    

Bonus: If you're upgrading Wagtail

If this error popped up after a Wagtail version upgrade, double-check you followed the official upgrade steps—some major versions require running specific migration commands or handling schema changes before running your app's migrations.

内容的提问来源于stack exchange,提问作者priyanka priya

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.26 07:04:23