收藏
回答

miniprogram-ci 上传失败,提示类型错误

问题:使用 python + js 接入微信提供的 miniprogram-ci 做自动打包上传工具。在上传时提示 project.type is miniGame, but appid (游戏app id) is MiniProgram。有尝试过把 type 改成 miniProgram,同样报错并会提示 app.json 文件不存在,因为本身就不是小程序而是小游戏工程。游戏工程目录见下文图。找了一圈没看到解决方案,请问有谁遇到了吗,怎么解决呢?

完整报错信息如下:

Error: : project.type is miniGame, but appid(游戏app id) is MiniProgram
    at throwError (/Users/qtz/node_modules/miniprogram-ci/dist/utils/common.js:2:1095)
    at checkProjectTypeMatchProjectAttr (/Users/qtz/node_modules/miniprogram-ci/dist/core/compile/index.js:2:958)
    at async compile (/Users/qtz/node_modules/miniprogram-ci/dist/core/compile/index.js:2:1509)
    at async innerUpload (/Users/qtz/node_modules/miniprogram-ci/dist/ci/upload.js:2:1968)
    at async upload (/Users/qtz/node_modules/miniprogram-ci/dist/ci/upload.js:2:1014)
    at async Object.upload (/Users/qtz/node_modules/miniprogram-ci/dist/utils/report.js:2:1403)
    at async /Users/qtz/Work/h5/tools/package/wechat/upload.js:73:30 {
  code: 30000,
  path: ''
}

上传代码如下:

const project = new ci.Project({
    appid: appid,
    type: 'miniGame',
    projectPath: projectPath, // 项目路径
    privateKeyPath: path.join(__dirname, `./private.${appid}.key`), // 密钥的路径
    ignores: ['node_modules/**/*', 'remote/**/*'],
})
const uploadParams = {
    project,
    version: app_version,
    desc: descs,
    setting: {
        es6: false, // es6 转 es5
        disableUseStrict: true,
        autoPrefixWXSS: true, // 上传时样式自动补全
        minifyJS: true,
        minifyWXML: true,
        minifyWXSS: true,
    },
    onProgressUpdate: console.log
}
console.log('uploadParams:', uploadParams)
const uploadResult = await ci.upload(uploadParams)
console.log('uploadResult:', uploadResult)

游戏在小程序后台注册的类型是,游戏-休闲游戏:


游戏工程结构如下,启动json为 game.json:

回答关注问题邀请回答
收藏

1 个回答

  • Forever
    Forever
    04-02

    有没有官方的大大来解答下喔

    04-02
    有用
    回复
登录 后发表内容