Build error on Cocos2d-x JS / [Cocos 2.1]

Everytime I try to compile (building works just fine) a project I have, but on compilation it fails and shows me this log.

Building apk...
running: '"D:\CocosCreator\resources\cocos2d-x\tools\cocos2d-console\bin\cocos" jscompile -s "D:\CocosProjects\DemoCollections\build\jsb-default\frameworks\runtime-src\proj.android\assets" -d "D:\CocosProjects\DemoCollections\build\jsb-default\frameworks\runtime-src\proj.android\assets" --env "COCOS_X_ROOT=D:\CocosCreator\resources\cocos2d-x;ANDROID_SDK_ROOT=C:\Program Files (x86)\Android\android-sdk;COCOS_CONSOLE_ROOT=D:\CocosCreator\resources\cocos2d-x\tools\cocos2d-console\bin;NDK_ROOT=C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r11c;COCOS_FRAMEWORKS=D:\CocosCreator\resources\;ANT_ROOT=C:\Program Files (x86)\Android\android-sdk\tools"'

Traceback (most recent call last):
  File "D:\CocosCreator\resources\cocos2d-x\tools\cocos2d-console\bin\/cocos.py", line 943, in <module>
    if not _check_python_version():
  File "D:\CocosCreator\resources\cocos2d-x\tools\cocos2d-console\bin\/cocos.py", line 886, in _check_python_version
    print(MultiLanguage.get_string('COCOS_PYTHON_VERSION_TIP_FMT') % (major_ver, minor_ver))
  File "D:\CocosCreator\resources\cocos2d-x\tools\cocos2d-console\bin\MultiLanguage.py", line 52, in get_string
    fmt = cls.get_instance().get_current_string(key)
  File "D:\CocosCreator\resources\cocos2d-x\tools\cocos2d-console\bin\MultiLanguage.py", line 46, in get_instance
    cls.instance = MultiLanguage()
  File "D:\CocosCreator\resources\cocos2d-x\tools\cocos2d-console\bin\MultiLanguage.py", line 97, in __init__
    self.cfg_info = json.load(f, encoding='utf-8')
  File "C:\Users\AxD\AppData\Local\Programs\Python\Python36-32\lib\json\__init__.py", line 296, in load
    return loads(fp.read(),
  File "C:\Users\AxD\AppData\Local\Programs\Python\Python36-32\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 29707: character maps to <undefined>
Error running command, return code: 1.

I have tried compiling using python 3.6 and 2.7 respectively, none of them works… any idea?

this is my output when I do cocos -v

$ cocos -v
2.1

Why you use 2.1 Version?
Cocos2D - JS was intergrated in Cocos2D-X. So Install cocos2d-x-3.13.1 first.

this is my output when i do cocos in command

Hwangui-MacBook-Pro:~ Hwang$ cocos -v
cocos2d-x-3.13.1


I don’t really know, the version i took was directly from the installer using the Cocos Creator download… I installed that and started working on it, then cocos binary outputs that version I wrote.

I haven’t compiled anything from sources or anything.

I didn’t use that method. I will let you know my install process.

Follow next steps

1) Python Installation

Most of the time, you will be dealing with the Cocos console to create, run, compile,
and deploy your project. The console uses Python. So, the first thing you need to do is to install Python. You can download it from the official Python site at Download Python | Python.org.

If you are developing on MacOS X, it comes with Python installed by default.

2) Cocos Console Setup

For Cocos2d-js, the development environment is actually a part of the Cocos console, so you have to download the Cocos2d-x bundle, or you may also go for the HTML5 Lite version if you wish to develop only for the Web.

• Download the cocos2d-x bundle from https://cocos2d-x.org/ download.
• Extract the zip file to your local drive.
• Open the terminal on Mac or the command prompt on Windows
and navigate to the extracted folder.
• Run the following command:

And, typing follow line in command

python setup.py

• This will set up the Cocos console, which uses both Android and iOS environment settings, and update the environment variables.

3) Creating Your First App

Create a separate folder of your choice in your favorite location. It is good practice to keep all of your Cocos2d-js projects within one root folder.
Open the terminal and navigate to the created folder path, then execute the following commands:

• Cocos2d-js project:

cocos new sampleproject -l js

1 Like

Oh sweet, that is amazing, thank you very much for helping memout giving me the proper steps to build, also to mention, I’m on Windows, so yes I have installed Python before but not for building Cocos2d-x, thansk again I will try in a couple of hours when I wake up since it’s 2 am where I’m at hehehe, thanks again!

What a relief!!! ^.^

I kept getting the same thing, instead of Cocos 2.1, now it said Cocos 2.2 Pfft, not like I’m getting the same output as you, is that the correct thing to output?

Anyways I don’t think I’m going to keep on working with such struggles.