KcH
KcH

Reputation: 3502

Run a UI5 sample application from the documentation

I am stuck on running a sample application.

Steps I tried so far:

  1. Download the sample.
  2. Open in some editor (VScode)
  3. Run npm-install
  4. After referring some StackOverflow questions, I ran npm install --global @ui5/cli
  5. Then start the server with ui5 serve -o index.html

I got the following error message:

[npm translator] Failed to locate package.json for directory "F:\sap.m.sample.TableDnD"

What I found is there is no package.json file in this sample.

I tried a sample package.json from a running sample(Worklist app)from docs and made a change to name as of current project as:

{
  "name": "sap.m.sample.TableDnD", // It was Worklist in sample
  "version": "1.0.0",
  "author": "SAP SE",
  "description": "UI5 Demo App - sap.m.sample.TableDnD(Standalone)", // It was Worklist in sample
  "private": true,
  "scripts": {
    "start": "ui5 serve",
    "lint": "eslint webapp",
    "build": "rimraf dist && ui5 build --a"
  },
  "dependencies": {
    "@openui5/sap.ui.core": "^1.60",
    "@openui5/sap.ui.layout": "^1.60",
    "@openui5/sap.m": "^1.60",
    "@openui5/sap.f": "^1.60",
    "@openui5/themelib_sap_belize": "^1.60"
  },
  "devDependencies": {
    "@ui5/cli": "^1.0.0",
    "eslint": "^4.19.1",
    "rimraf": "^2.6.2"
  }
}

I tried running all the steps again then I got another error saying:

No specification version defined for root project sap.m.sample.TableDnD

Any help or guiding links would be helpful. Looking for a solution who can just try the sample app in link and run.

Upvotes: 2

Views: 2944

Answers (1)

A.vH
A.vH

Reputation: 1026

You need to run

ui5 init

once in your project directory. It will create the missing ui5.yaml and then ui5 serve -o index.html should work.

This is more deeply explained in UI5 Tooling

Upvotes: 3

Related Questions