ui5-middleware-cap

raw JSON →
3.3.4 verified Sat Apr 25 auth: no javascript

UI5 CLI middleware that embeds the CDS server middleware from SAP Cloud Application Programming Model (CAP) into the UI5 development server. Version 3.3.4 requires @ui5/cli >=3 and @sap/cds >=6.8.1. It improves local development by integrating CAP services (including mock data and in-memory database) directly into the UI5 dev server lifecycle. Community-maintained, with active monitoring and contributions.

error Error: Cannot find module '@sap/cds'
cause @sap/cds not installed or version too low
fix
Run npm install @sap/cds@>=6.8.1 -D and ensure it's in package.json
error Invalid configuration: specVersion must be '3.0'
cause ui5.yaml uses old specVersion incompatible with middleware
fix
Update ui5.yaml specVersion: '3.0'
error TypeError: cds.server is not a function
cause Incompatible @sap/cds version (<6.8.1)
fix
Upgrade @sap/cds to >=6.8.1
breaking Major version 3 requires @ui5/cli >=3 (specVersion 3.0). Older UI5 CLI versions are not compatible.
fix Upgrade @ui5/cli to latest major version 3+ and ensure ui5.yaml uses specVersion: '3.0'.
deprecated The 'in-memory' option has been renamed to 'in-memory?' with optional question mark syntax. Old usage may break.
fix Use 'in-memory?' instead of 'in-memory' in ui5.yaml options.
gotcha CDS server is only attached if '@sap/cds' is listed as a dependency or devDependency, not just transitive.
fix Add '@sap/cds' to your package.json dependencies or devDependencies.
npm install ui5-middleware-cap
yarn add ui5-middleware-cap
pnpm add ui5-middleware-cap

Shows minimal setup: install deps, configure ui5.yaml, verify CDS version, start UI5 server.

// Step 1: Install dependencies
npm add ui5-middleware-cap @sap/cds -D

// Step 2: Create ui5.yaml in project root with:
// specVersion: '3.0'
// metadata:
//   name: my-app
// server:
//   customMiddleware:
//   - name: ui5-middleware-cap
//     afterMiddleware: compression
//     mountPath: '/cap'

// Step 3: Ensure @sap/cds version >=6.8.1 in package.json

// Step 4: Run UI5 dev server
// ui5 serve --port 8080 --open /cap