小程序使用CI上传失败,提示无法找到第三方库?
环境: Ubuntu:18.04 Node: v12.18.4 npm: 46.14.6 开发过程: 项目中使用了vant-weapp的UI组件;通过以下命令安装: npm i @vant/weapp -S --production
在项目根目录创建upload.js文件,用于CI上传; const ci = require('miniprogram-ci')
const projectConfig = require('./project.config.json')
const project = new ci.Project({
appid: projectConfig.appid,
type: 'miniProgram',
projectPath: './',
privateKeyPath: './private.key',
ignores: ['node_modules/**/*'],
})
async function upload() {
const uploadResult = await ci.upload({
project,
version: '0.1.7',
setting: projectConfig.setting,
onProgressUpdate: console.log,
})
console.log(uploadResult)
}
upload()
在调用上传代码之前,通过以下命令安装miniprogram-ci: npm install miniprogram-ci --save
最后使用以下命令上传: node upload.js
在使用了vant-weapp的地方报错: (node:258) UnhandledPromiseRejectionWarning: Error: pages/order/order.json: ["usingComponents"]["van-sticky"]: "@vant/weapp/sticky/index" not found
at Object.throwError (/drone/src/node_modules/miniprogram-ci/dist/utils/common.js:1:461)
at _checkComponentPath (/drone/src/node_modules/miniprogram-ci/dist/json/common.js:1:3203)
at async Object.exports.checkComponentPath (/drone/src/node_modules/miniprogram-ci/dist/json/common.js:1:5582)
at async checkComponentPath (/drone/src/node_modules/miniprogram-ci/dist/json/page/page.js:1:1305)
at async compilePageJSON (/drone/src/node_modules/miniprogram-ci/dist/json/page/page.js:1:2028)
at async Object.getPageJSON (/drone/src/node_modules/miniprogram-ci/dist/json/page/page.js:1:2394)
at async compilePageJSON (/drone/src/node_modules/miniprogram-ci/dist/compile/handler/mpjson.js:1:599)
at async Object.compileJSON (/drone/src/node_modules/miniprogram-ci/dist/compile/handler/mpjson.js:1:1099)
at async Object.compile (/drone/src/node_modules/miniprogram-ci/dist/compile/mini_program.js:1:977)
at async Object.upload (/drone/src/node_modules/miniprogram-ci/dist/upload/upload.js:1:1182)
(node:258) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:258) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.