Cocos Creator CLI Build Debug
Debug Cocos Creator 3.x CLI build failures — scene JSON corruption, library import errors, and resource missing errors.
Common CLI Build Errors
| Error |
Likely Cause |
Check |
| Error 1222/1223 |
Scene JSON corrupt |
python3 -c "import json; json.load(open('assets/scenes/MainScene.scene'))" |
resource.ac not found |
Asset bundle missing |
Check assets/bundle/ exists |
| Module import failed |
TS compile error |
Run npx tsc --noEmit |
| Library version mismatch |
Cocos version conflict |
Check package.json @cocos/creator version |
WeChat Mini Game (wechatgame) Known Issues
Cannot set property 'w' of undefined (2026-06-16)
- Symptom: Console shows
TypeError: Cannot set property 'w' of undefined at trt (virtual cc-XXX.js:2)
- Root cause: Cocos engine rendering pipeline initialization fail →
FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT in OpenGL framebuffer
- NOT fixed by: Disabling video/webview engine modules, delaying bootstrap init, or changing camera settings
- Status: Confirmed as Cocos 3.8.8 engine bug on WeChat mini game platform
- Workaround: Not found yet — needs Cocos official patch or engine config deep-dive
- Evidence: Bootstrapper mounts successfully, 7 menu buttons created, project starts — but black screen due to rendering pipeline fail
Build Performance
- First build with full engine modules: ~42 seconds
- After disabling unused modules: ~7 seconds
- Key modules to keep for 2D zen game: base, 2d, ui, graphics, gfx-webgl, animation, audio, tween, particle-2d
- Modules safe to disable: video, webview, 3d (if 2D only), physics-3d, gfx-webgpu
Scene Config Tips
project.json startScene must match the actual scene UUID
- Build uses
profiles/v2/packages/builder.json scenes[] list — all listed scenes get built
overwriteProjectSettings in builder.json can override engine module settings
- After changing engine.json modules, run a full rebuild (not incremental)
Build Command (CLI, no GUI needed)
/Applications/Cocos/Creator/3.8.8/CocosCreator.app/Contents/MacOS/CocosCreator --project . --build "platform=wechatgame"
Recovery Flow
- Fix any TS compile errors first
- If scene corrupt: restore from git or rebuild in Editor
- Clear library cache:
rm -rf library/
- Re-import assets: Open project in Cocos Creator (GUI)
See references/error-catalog.md for complete error code reference.
1---2name: cocos-creator-cli-build-debug3description: Cocos Creator CLI Build Debug4---56# Cocos Creator CLI Build Debug78Debug Cocos Creator 3.x CLI build failures — scene JSON corruption, library import errors, and resource missing errors.910## Common CLI Build Errors1112| Error | Likely Cause | Check |13|-------|-------------|-------|14| Error 1222/1223 | Scene JSON corrupt | `python3 -c "import json; json.load(open('assets/scenes/MainScene.scene'))"` |15| `resource.ac` not found | Asset bundle missing | Check `assets/bundle/` exists |16| Module import failed | TS compile error | Run `npx tsc --noEmit` |17| Library version mismatch | Cocos version conflict | Check `package.json` `@cocos/creator` version |1819## WeChat Mini Game (wechatgame) Known Issues2021### `Cannot set property 'w' of undefined` (2026-06-16)22- **Symptom**: Console shows `TypeError: Cannot set property 'w' of undefined at trt (virtual cc-XXX.js:2)`23- **Root cause**: Cocos engine rendering pipeline initialization fail → `FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT` in OpenGL framebuffer24- **NOT fixed by**: Disabling video/webview engine modules, delaying bootstrap init, or changing camera settings25- **Status**: Confirmed as Cocos 3.8.8 engine bug on WeChat mini game platform26- **Workaround**: Not found yet — needs Cocos official patch or engine config deep-dive27- **Evidence**: Bootstrapper mounts successfully, 7 menu buttons created, project starts — but black screen due to rendering pipeline fail2829### Build Performance30- First build with full engine modules: ~42 seconds31- After disabling unused modules: ~7 seconds32- Key modules to keep for 2D zen game: base, 2d, ui, graphics, gfx-webgl, animation, audio, tween, particle-2d33- Modules safe to disable: video, webview, 3d (if 2D only), physics-3d, gfx-webgpu3435### Scene Config Tips36- `project.json` `startScene` must match the actual scene UUID37- Build uses `profiles/v2/packages/builder.json` `scenes[]` list — all listed scenes get built38- `overwriteProjectSettings` in builder.json can override engine module settings39- After changing engine.json modules, run a full rebuild (not incremental)4041## Build Command (CLI, no GUI needed)4243```bash44/Applications/Cocos/Creator/3.8.8/CocosCreator.app/Contents/MacOS/CocosCreator --project . --build "platform=wechatgame"45```4647## Recovery Flow48491. Fix any TS compile errors first502. If scene corrupt: restore from git or rebuild in Editor513. Clear library cache: `rm -rf library/`524. Re-import assets: Open project in Cocos Creator (GUI)5354See `references/error-catalog.md` for complete error code reference.