How can I run a specific SAPUI5 control sample from Demo Kit locally?

Viewed 81

I am looking up the sample for the sap.m.UploadCollection control. I've downloaded and run the sample package locally using the following commands:

npm install

and then

ui5 serve -o index.html

I get the following error in console when navigating to http://localhost:8080/index.html:

2022-08-15 16:56:35.802600 Failed to load component for container container - ModuleError: Failed to resolve dependencies of 'sap/m/sample/UploadCollection/Page.controller.js'
-> 'sap/m/MessageToast.js': failed to load 'sap/m/MessageToast.js' from ./resources/sap/m/MessageToast.js: script load error
ModuleError: Failed to resolve dependencies of 'sap/m/sample/UploadCollection/Page.controller.js'

If I move the Page.contoller.js to a newly created controller folder and move the Page.view.xml to the newly created view folder, then a different error occurs.

How can the downloaded sample project run locally?

1 Answers

Make sure that the downloaded project has the UI5 Tooling part is correctly configured according to the documentation https://sap.github.io/ui5-tooling/pages/Configuration

In your case, the control sap.m.UploadCollection is deprecated since UI5 1.88. So download one of the sap.m.upload.UploadSet samples instead. When downloaded, see which settings are missing in the ui5.yaml config file. E.g. run the below UI5 Tooling commands to add the missing settings:

ui5 use openui5@latest
ui5 add sap.ui.core sap.m sap.ui.layout sap.ui.unified themelib_sap_fiori_3 themelib_sap_horizon

This will at least allow the application to start.

Related