cocos2d / cocos2d-js

cocos2d-x for JS
http://www.cocos2d-x.org
MIT License
1.86k stars 490 forks source link

.cocos-project.json not defined in Moonwarriors and tests #193

Closed ZippoLag closed 10 years ago

ZippoLag commented 10 years ago

When attepting to run the source I get a "Can't find config file .cocos-project.json" error.

There exists a "project.json" file in the "samples/js-moonwarriors" folder, but renaming it to ".cocos-project.json" then causes the followin error when attempting the run command:

C:\Cocos2d-JS\samples\js-moonwarriors>cocos run -p web

C:\Cocos2d-JS\samples\js-moonwarriors>python C:\Cocos2d-JS\tools\cocos2d-console
\bin\/cocos.py run -p web
Runing command: compile
Traceback (most recent call last):
  File "C:\Cocos2d-JS\tools\cocos2d-console\bin\/cocos.py", line 578, in <module
>
    run_plugin(command, argv, plugins)
  File "C:\Cocos2d-JS\tools\cocos2d-console\bin\/cocos.py", line 558, in run_plu
gin
    dependencies_objects[dep_name] = run_plugin(dep_name, argv, plugins)
  File "C:\Cocos2d-JS\tools\cocos2d-console\bin\/cocos.py", line 560, in run_plu
gin
    plugin.run(argv, dependencies_objects)
  File "C:\Cocos2d-JS\tools\cocos2d-console\bin\..\plugins\project_compile\proje
ct_compile.py", line 635, in run
    self.parse_args(argv)
  File "C:\Cocos2d-JS\tools\cocos2d-console\bin\cocos.py", line 195, in parse_ar
gs
    self._project = Project(os.path.abspath(os.getcwd()))
  File "C:\Cocos2d-JS\tools\cocos2d-console\bin\cocos.py", line 229, in __init__

    self._parse_project_json(project_dir)
  File "C:\Cocos2d-JS\tools\cocos2d-console\bin\cocos.py", line 241, in _parse_p
roject_json
    lang = project_info[Project.KEY_PROJ_TYPE]
KeyError: 'project_type'

If I try to run this by hosting it in a server, I get the following errors in Chrome: Failed to load resource: the server responded with a status of 404 (Not Found) http://127.0.0.1:50152/frameworks/cocos2d-html5/CCBoot.js Uncaught ReferenceError: cc is not defined

All of the above also applies to the contents of "js-tests".

dingpinglv commented 10 years ago

I'm sorry, the js-tests and js-moonwarriors don't support cocos console command yet, we will implement this feature later.

ZippoLag commented 10 years ago

I see, but you should note that they also don't work if hosted on a web server as a simple cocos2d-html5 game.

jtianling commented 10 years ago

Same problem.

ZippoLag commented 10 years ago

This has been fixed for a while now, what source are you downloading from?

jtianling commented 10 years ago

cocos2d-js-v3.0-beta

jtianling commented 10 years ago

Is it fixed? The issue is still open.

linshun commented 10 years ago

It has been fixed. Please checkout cocos2d-js-v3.0-beta. I will close this issue.

jtianling commented 10 years ago

I indeed use the version cocos2d-js-v3.0-beta and have the problem.

ZippoLag commented 10 years ago

That's indeed very strange. I downloaded the .zip from cocos2d-x.org and it works fine.. Also, the file exists in the repo: https://github.com/cocos2d/cocos2d-js/tree/master/samples/js-moonwarriors