Hi,
I am getting error
“cocos: command not found”
I tried all the steps mentioned in install
./setup.py and adding environment variables to .profile
Here is the console log
gamebox:cocos2d-js$./setup.py
Setting up cocos2d-x…
-> Adding COCOS2D_CONSOLE_ROOT environment variable… ALREADY ADDED
-> Looking for NDK_ROOT envrironment variable… FOUND
-> Looking for ANDROID_SDK_ROOT envrironment variable… FOUND
-> Looking for ANT_ROOT envrironment variable… FOUND
COCOS_CONSOLE_ROOT was already added. Edit “/Users/gamebox/.profile” for manual changes
Please execute command: “source /Users/gamebox/.profile” to make added system variables take effect
gamebox:cocos2d-js$source /Users/gamebox/.profile
echo $PATH contains
/Users/gamebox/cocos2d-js/tools/cocos2d-console/bin
How to create new game with cocos command from console - I’m on Mac OS - cocos2d-js 3.0
We had the same issue, the resources online don’t tell you that you have to change your directory in the terminal to run the command.
Change to cocos2d-xroot/tools/cocos2d-console/bin
The command is also a python file so run it as cocos.py or ./cocos.py
Hope that helps
Check out our channel which has tutorials on Cocos2d-x with V3 tutorials coming very soon.
1 Like
Hi, @indygamer @SonarSystems
I didn’t know why you got the message Please execute command: "source /Users/gamebox/.profile" to make added system variables take effect
The right message should be source /Users/gamebox/.bash_profile
if you use a Mac
I will report this issue to our cocos console developer.
Sorry for the inconvenience
Huabin
@indygamer
I think it’s because of the incorrect permission of file /Users/gamebox/cocos2d-js/tools/cocos2d-console/bin/cocos
. Maybe it doesn’t have permission of execute.
Can you take a look at the file? Whether it has the permission of execute? Use this command in terminal:
ls -l /Users/gamebox/cocos2d-js/tools/cocos2d-console/bin/cocos
The permission of my cocos is : -rwxr-xr-x
Thanks all. Found a workaround solution, I had tried to
git clone https://github.com/cocos2d/cocos2d-js
and then
git submodule update --init
For some reason, all the submodules were not updated.
Later downloaded the official zip release and replaced the directory contents. Now its working fine.
3 Likes
@pandamicro thx,i resolve it through your idea.