记录个问题及解决方法
在这之前要注意官方文档的一句话!
注意 :如果是从编辑器拷贝出来的内置 cocos2d-x 目录,可以跳过该步骤 引擎定制工作流程---- 定制 Cocos2d-x 引擎---- 初始化。
问题: gulp init 失败
下载文件失败(<gitlab访问不了,github网络波动>,自己手动下载 )
1.下载cocos2d-x-lite-external(gitee | github)文件对应版本(gitee: (切分支2.x–>克隆/下载->下载zip)
将下载到的zip文件重命名v24-6.zip为 保存到D:\custom\2.4.6\cocos2d-x\文件夹(自定义cocos2d-x引擎目录)下
更改download-deps.py文件,不让它下载
#!/usr/bin/env python
#coding=utf-8
#
# ./download-deps.py
#
# 文件名称v24-6.zip
# zip解压位置 工作目录/cocos2d-x-lite-external/24-6/v24-6.zip
# mirror_repo_url = "https://gitlab.cocos.net/publics/%s/-/archive/%s/%s-%s.zip" % (self._repo_name, self._current_version, self._repo_name, self._current_version)
更改1
mirror_repo_url = "" # 用不到,写意思意思
更改2
# if mirror is None:
# self._url = select_fastest_url([self._url, mirror_repo_url])
# elif mirror == "gitlab":
# self._url = mirror_repo_url
self._url = mirror_repo_url
def run(self, workpath, folder_for_extracting, remove_downloaded, force_update, download_only):
...
更改3
# self.download_zip_file() // 注释掉,改为手动gitee下载zip,更名为v24-6.zip 保存在\custom\2.4.6\resources\cocos2d-x\下面
2.git submodule update失败
手动下载 bindings-generator ( github)(Code->Download ZIP),下载好后解压放到D:\custom\2.4.6\cocos2d-x\tools\bindings-generator下
这个不是分支,gitee上也没有镜像,只能到github 上下载(具体位置: engine-native/tools/bindings-generator @ ff32cff)。旧的版本JSB自动绑定有问题。
手动下载 cocos2d-console (github)(Code->Download ZIP),下载好后解压放到D:\custom\2.4.6\cocos2d-x\tools\cocos2d-console下
试了下使用这(gitee)(不切分支–>克隆/下载->下载zip)也可以但为了跟上面bindings-generator保持一致,也到github上下载(具体位置: engine-native/tools/cocos2d-console @ 29b9243)
更改gulpfile.js文件,不让它git submodule update
gulp.task('init', function(cb) {
execSync('python download-deps.py --remove-download no');
// execSync('git submodule update --init');
execSync('python download-bin.py --remove-download no', './tools/cocos2d-console');
cb();
});
3. 改好后文件后 重新执行命令
gulp init
下载 creator-console-2.zip(version.json和plugins 的压缩包 42.9MB) 也可能出错。。我一共下过5次<失败就再次gulp init>,成功过两次,嫌下载慢或老失败,可以参照 1 改download-bin.py文件。
D:\ProgramFiles\CocosDashboard_1.0.20\resources\.editors\Creator\custom\engine-native>gulp init
[09:17:29] Using gulpfile D:\ProgramFiles\CocosDashboard_1.0.20\resources\.editors\Creator\custom\engine-native\gulpfile.js
[09:17:29] Starting 'init'...
=======================================================
==> Prepare to download external libraries!
==> version file doesn't exist
==> Extracting files, please wait ...
==> Extraction done!
==> Cleaning cocos2d-x/external folder ...
==> Copying files...
==> Cleaning...
=======================================================
==> Prepare to download console binaries!
==> version file doesn't exist
==> Unrecognized zip format from your local 'creator-console-2.zip' file!
==> Download it from internet again, please wait...
==> Ready to download 'creator-console-2.zip' from 'https://github.com/cocos2d/console-binary/archive/creator-console-2.zip'
==> WARNING: Couldn't grab the file size from remote, use 'zip_file_size' section in 'D:\ProgramFiles\CocosDashboard_1.0.20\resources\.editors\Creator\custom\engine-native\tools\cocos2d-console\config.json'
==> Start to download, please wait ...
==> Downloading finished!al: 45045K, Percent: 97.31%, Speed: 997.43 KB/S
==> Extracting files, please wait ...
==> Extraction done!
==> Copying files...
==> Cleaning...
[09:19:08] Finished 'init' after 1.65 min