收藏
回答

miniprogram-ci preview 上传代码报错?

测试了一下npm包的版本均有问题。

miniprogram-ci@2.0.6

miniprogram-ci@2.0.4

miniprogram-ci@1.9.16

miniprogram-ci@1.9.8

配置如下:

          miniprogram-ci preview \

            -v false \

            --pp ./dist \

            --pkp ./private-key.txt \

            --enable-es6 true \

            --enable-es7 true \

            --enable-minify true \

            --enable-allowIgnoreUnusedFiles true \

            --enable-autoprefixwxss true \

            --uv ***** \

            --ud ***** \

            --appid ***** \

            -r 1


上周五还能用,今天周一我们公司所有的小程序CI全部异常。


项目使用 ts

ci 版本号 1.9.17

报错:

WARNING: 61 repetitive deprecation warnings omitted.

{
  type: 'SummerError',
  message: "TypeError: Cannot read properties of undefined (reading 'close')",
  stack: "TypeError: Cannot read properties of undefined (reading 'close')\n" +
    '    at Object.<anonymous> (/usr/local/bin/global/5/.pnpm/node_modules/chalk/index.js:72:75)\n' +
    '    at Module._compile (node:internal/modules/cjs/loader:1159:14)\n' +
    '    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)\n' +
    '    at Module.load (node:internal/modules/cjs/loader:1037:32)\n' +
    '    at Module._load (node:internal/modules/cjs/loader:878:12)\n' +
    '    at Module.require (node:internal/modules/cjs/loader:1061:19)\n' +
    '    at require (node:internal/modules/cjs/helpers:103:18)\n' +
    '    at Object.<anonymous> (/usr/local/bin/global/5/.pnpm/miniprogram-ci@1.9.17_eslint@8.57.0/node_modules/@babel/highlight/lib/index.js:10:15)\n' +
    '    at Module._compile (node:internal/modules/cjs/loader:1159:14)\n' +
    '    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)',
  code: 10046,
  path: 'miniprogram/api/account.ts',
  plugin: 'summer-typescript',
  hook: 'load'
}

切换至最新版本

ci: 2.0.8

报错:

child process stderr: getAppJSON error Error: miniprogram/app.json: ["pages"][0] could not find the corresponding file: "pages/index/index.js"
    at throwError (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/utils/common.js:1:1102)
    at checkPageExist (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/app/checkAppFields.js:1:1534)
    at checkMainPkgPages (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/app/checkAppFields.js:1:6047)
    at checkAppJSON (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/app/appJSON.js:1:2372)
    at /usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/app/appJSON.js:1:4242
    at i.scheduler (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/reactiveCache.js:1:1702)
    at reactiveEffect (/usr/local/bin/global/5/.pnpm/@vue+reactivity@3.0.5/node_modules/@vue/reactivity/dist/reactivity.cjs.js:46:24)
    at effect (/usr/local/bin/global/5/.pnpm/@vue+reactivity@3.0.5/node_modules/@vue/reactivity/dist/reactivity.cjs.js:21:9)
    at ReactiveJSONCompiler.registerOrGet (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/reactiveCache.js:1:1682)
    at /usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/reactiveCache.js:1:3413 {
  code: 10005,
  path: 'miniprogram/app.json'
}

CustomError: miniprogram/app.json: ["pages"][0] could not find the corresponding file: "pages/index/index.js"
    at throwError (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/utils/common.js:1:1102)
    at checkPageExist (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/app/checkAppFields.js:1:1534)
    at checkMainPkgPages (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/app/checkAppFields.js:1:6047)
    at checkAppJSON (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/app/appJSON.js:1:2372)
    at /usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/app/appJSON.js:1:4242
    at i.scheduler (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/reactiveCache.js:1:1702)
    at reactiveEffect (/usr/local/bin/global/5/.pnpm/@vue+reactivity@3.0.5/node_modules/@vue/reactivity/dist/reactivity.cjs.js:46:24)
    at effect (/usr/local/bin/global/5/.pnpm/@vue+reactivity@3.0.5/node_modules/@vue/reactivity/dist/reactivity.cjs.js:21:9)
    at ReactiveJSONCompiler.registerOrGet (/usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/reactiveCache.js:1:1682)
    at /usr/local/bin/global/5/.pnpm/miniprogram-ci@2.0.8_eslint@8.57.0/node_modules/miniprogram-ci/dist/modules/corecompiler/original/json/reactiveCache.js:1:3413 {
  code: 10005,
  path: 'miniprogram/app.json'
}

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

3 个回答

  • 张晨  🔆
    张晨 🔆
    07-31

    1.9.17 报错在你的node_modules的chalk里面 我猜测是版本有问题 可以试试chalk 4.1.2。

    2.0.8 就是正常的检查报错。相对1.9.17检查变得严格了。可以确认一下miniprogramRoot下面的相对路径是不是错了

    miniprogram/app.json: ["pages"][0] could not find the corresponding file: "pages/index/index.js"
    


    07-31
    有用
    回复 2
    • A二狗子🇨🇳
      A二狗子🇨🇳
      07-31
      1.9.17 包里面的依赖我们怎么修改
      2.0.8  对应位置我们是有页面的,但是我们整个项目是选择 ts 去做的,但是 ci 检查的是 js 文件,这个可以有办法修改哪里的配置,兼容 ts 项目嘛
      07-31
      回复
    • 517
      517
      07-31
      ts项目岂不是要把所有的ts都改成js才可行??
      07-31
      回复
  • Demons
    Demons
    07-31

    周一的问题已经修复了,你重新试试

    07-31
    有用
    回复 2
    • A二狗子🇨🇳
      A二狗子🇨🇳
      07-31
      就是使用了修复后的版本 1.9.17 和 2.0.8 尝试,都又出现了错误
      07-31
      回复
    • h.jamie
      h.jamie
      08-05
      pnpm i -g miniprogram-ci 还会有同样问题,使用 npm 则正常,主要原因是 chalk 和 ansi-styles 依赖版本冲突的问题,建议进一步修复
      08-05
      回复
  • 小炒肉
    小炒肉
    08-02

    小程序IDE模版ts项目 setting.useCompilerPlugins: [ 'typescript', 'less' ]

    执行miniprogram-ci upload 时报错:

    [log] {"id":"50000000","status":"doing","message":"Compile miniprogram"}

    [log] {"id":"50000001","status":"doing","message":"Compile jSON files"}

    child process stderr: getAppJSON error Error: app.json: ["pages"][0] could not find the corresponding file: "pages/index/index.js"


    08-02
    有用 1
    回复 2
    • 小炒肉
      小炒肉
      08-02
      测试了一遍,2.0+的全部不可用,锁在1.9.17上传成功了
      08-02
      回复
    • 张晨  🔆
      张晨 🔆
      08-06回复小炒肉
      2.0.8 试试 useProjectConfig这个参数
      08-06
      回复
登录 后发表内容