[SOLVED]UnboundLocalError: local variable 'f' referenced before assignment


Trying to publish my Cocos2d-JS project using the command and getting the following error:

cocos compile -p web -m release
Running command: compile
Building mode: release
Traceback (most recent call last):
  File "/Users/ed/cocos2d-js-v3.3/tools/cocos2d-console/bin/cocos.py", line 719, in <module>
    run_plugin(command, argv, plugins)
  File "/Users/ed/cocos2d-js-v3.3/tools/cocos2d-console/bin/cocos.py", line 682, in run_plugin
    plugin.run(argv, dependencies_objects)
  File "/Users/ed/cocos2d-js-v3.3/tools/cocos2d-console/plugins/project_compile/project_compile.py", line 1435, in run
  File "/Users/ed/cocos2d-js-v3.3/tools/cocos2d-console/plugins/project_compile/project_compile.py", line 1150, in build_web
    build_web.gen_buildxml(project_dir, project_json, publish_dir, buildOpt)
  File "/Users/ed/cocos2d-js-v3.3/tools/cocos2d-console/plugins/project_compile/build_web/__init__.py", line 54, in gen_buildxml

UnboundLocalError: local variable 'f' referenced before assignment

Anyone had this?

Problem was with the misconfigured project.json file.


Command “cocos new MyGame -p com.your_company.mygame -l js -d .” create directory “frameworks”.

If you delete it for some reason (not include for git, remove, git clone - for example). You will get this error.

You can solve this by creating test new project (like at first my line). And copy “frameworks” directory to your project.


WTF? This post was like 2 years ago!
Thanks for the help anyway :slight_smile: