我们可以使用如下命令行来安装SAPUI5Tools:npminstall--global@ui5/cli进入一个空文件夹,执行命令行ui5init报错:Initializationnotpossible:缺少package.json文件然后使用命令行npminit生成一个package.json:然后重新执行ui5init:出现新的错误信息:Couldnotdetectprojecttype:Couldnotfind'webapp'or'src'/'test'文件夹。应用程序应该只有一个'webapp'文件夹。然后我手动创建一个webapp文件夹。之后init成功执行,自动创建了一个ui5.yaml文件:内容如下:根据我文章中介绍的使用generator-easy-ui5快速创建SAPUI5应用工程结构的工具,创建SAPUI5应用程序层次结构所需的基本文件。生成后查看其package.json的脚本区定义的脚本:"scripts":{"start":"fiorirun--open'index.html'","start-local":"fiorirun--config./ui5-local.yaml--open'index.html'","start-noflp":"fiorirun--open'index.html'","build":"ui5build-a--clean-dest--include-task=generateManifestBundlegenerateCachebusterInfo","deploy":"fiori验证","deploy-config":"fiori添加部署配置","unit-tests":"fiorirun--opentest/unit/unitTests.qunit.html","int-tests":"fiorirun--opentest/integration/opaTests.qunit.html"},脚本中的fiori命令就是提到的SAPUI5Tools的命令提示行工具在本文的标题中CLI。执行npmrunstart,实际执行的命令是fiorirun--open'index.html':最后运行效果:我们直接运行fiorideploy,会报错:'fiori'isnotrecognizedasinternalorexternal命令、可运行程序或批处理文件。它需要在npm包装器中运行:npmrundeploy:错误消息:未检测到部署配置。运行npmrundeploy-config首先添加配置。表示没有检测到部署配置,需要先运行另外一个命令:npmrundeploy-config。首先选择ABAP环境:这个命令行npmrundeploy-config最底层还是yo:TargetSystemURL,随意维护一个即可,后面可以修改:输入部署后生成的bsp应用的名称到ABAP系统和存储的ABAP包名称,即可成功生成部署配置:Jerry更多原创文章在这里:《汪子熙》:
