cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

I am facing an issue with running the build mta file

Chidvilas
Discoverer
0 Kudos
734

Anyone please help me with this error

npm ERR! A complete log of this run can be found in: /home/user/.npm/_logs/2024-11-22T11_21_22_784Z-debug-0.log
[2024-11-22 11:21:22] ERROR could not build the "PostgreSQLdemobrowse" module: could not execute the "npm ci" command: exit status 1
make: *** [Makefile_20241122112105.mta:37: PostgreSQLdemobrowse] Error 1
Error: could not build the MTA project: could not execute the "make -f Makefile_20241122112105.mta p=cf mtar= strict=true mode=" command: exit status 2

Here is the log files

0 verbose cli /local/asdf-inst-inbox-runtime/installs/nodejs/20.12.0/bin/node /home/user/.asdf-inst/installs/nodejs/20.12.0/bin/npm
1 info using npm@10.5.0
2 info using node@v20.12.0
3 timing npm:load:whichnode Completed in 1ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:/local/asdf-inst-inbox-runtime/installs/nodejs/20.12.0/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:/home/user/projects/PostgreSQLdemo/app/browse/.npmrc Completed in 0ms
10 timing config:load:project Completed in 3ms
11 timing config:load:file:/home/user/.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/home/user/.node_modules_global/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 0ms
16 timing config:load Completed in 8ms
17 timing npm:load:configload Completed in 8ms
18 timing config:load:flatten Completed in 1ms
19 timing npm:load:mkdirpcache Completed in 0ms
20 timing npm:load:mkdirplogs Completed in 0ms
21 verbose title npm ci
22 verbose argv "ci"
23 timing npm:load:setTitle Completed in 0ms
24 timing npm:load:display Completed in 0ms
25 verbose logfile logs-max:10 dir:/home/user/.npm/_logs/2024-11-22T11_21_22_784Z-
26 verbose logfile /home/user/.npm/_logs/2024-11-22T11_21_22_784Z-debug-0.log
27 timing npm:load:logFile Completed in 5ms
28 timing npm:load:timers Completed in 0ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 25ms
31 timing arborist:ctor Completed in 1ms
32 verbose loadVirtual Error: loadVirtual requires existing shrinkwrap file
32 verbose loadVirtual     at Arborist.loadVirtual (/local/asdf-inst-inbox-runtime/installs/nodejs/20.12.0/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/load-virtual.js:51:18)
32 verbose loadVirtual     at async CI.exec (/local/asdf-inst-inbox-runtime/installs/nodejs/20.12.0/lib/node_modules/npm/lib/commands/ci.js:48:5)
32 verbose loadVirtual     at async module.exports (/local/asdf-inst-inbox-runtime/installs/nodejs/20.12.0/lib/node_modules/npm/lib/cli-entry.js:61:5)
33 timing command:ci Completed in 3ms
34 verbose stack Error: 
34 verbose stack The `npm ci` command can only install with an existing package-lock.json or
34 verbose stack npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
34 verbose stack later to generate a package-lock.json file, then try again.
34 verbose stack
34 verbose stack Clean install a project
34 verbose stack
34 verbose stack Usage:
34 verbose stack npm ci
34 verbose stack
34 verbose stack Options:
34 verbose stack [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
34 verbose stack [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
34 verbose stack [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
34 verbose stack [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
34 verbose stack [--no-bin-links] [--no-fund] [--dry-run]
34 verbose stack [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
34 verbose stack [-ws|--workspaces] [--include-workspace-root] [--install-links]
34 verbose stack
34 verbose stack aliases: clean-install, ic, install-clean, isntall-clean
34 verbose stack
34 verbose stack Run "npm help ci" for more info
34 verbose stack     at CI.usageError (/local/asdf-inst-inbox-runtime/installs/nodejs/20.12.0/lib/node_modules/npm/lib/base-command.js:114:26)
34 verbose stack     at /local/asdf-inst-inbox-runtime/installs/nodejs/20.12.0/lib/node_modules/npm/lib/commands/ci.js:54:18
34 verbose stack     at async CI.exec (/local/asdf-inst-inbox-runtime/installs/nodejs/20.12.0/lib/node_modules/npm/lib/commands/ci.js:48:5)
34 verbose stack     at async module.exports (/local/asdf-inst-inbox-runtime/installs/nodejs/20.12.0/lib/node_modules/npm/lib/cli-entry.js:61:5)
35 verbose cwd /home/user/projects/PostgreSQLdemo/app/browse
36 verbose Linux 6.1.95-gardenlinux-cloud-amd64
37 verbose node v20.12.0
38 verbose npm  v10.5.0
39 error code EUSAGE
40 error
40 error The `npm ci` command can only install with an existing package-lock.json or
40 error npm-shrinkwrap.json with lockfileVersion >= 1. Run an install with npm@5 or
40 error later to generate a package-lock.json file, then try again.
40 error
40 error Clean install a project
40 error
40 error Usage:
40 error npm ci
40 error
40 error Options:
40 error [--install-strategy <hoisted|nested|shallow|linked>] [--legacy-bundling]
40 error [--global-style] [--omit <dev|optional|peer> [--omit <dev|optional|peer> ...]]
40 error [--include <prod|dev|optional|peer> [--include <prod|dev|optional|peer> ...]]
40 error [--strict-peer-deps] [--foreground-scripts] [--ignore-scripts] [--no-audit]
40 error [--no-bin-links] [--no-fund] [--dry-run]
40 error [-w|--workspace <workspace-name> [-w|--workspace <workspace-name> ...]]
40 error [-ws|--workspaces] [--include-workspace-root] [--install-links]
40 error
40 error aliases: clean-install, ic, install-clean, isntall-clean
40 error
40 error Run "npm help ci" for more info
41 verbose exit 1
42 timing npm Completed in 141ms
43 verbose code 1
44 error A complete log of this run can be found in: /home/user/.npm/_logs/2024-11-22T11_21_22_784Z-debug-0.log

Here is the mta.yaml code

_schema-version: 3.3.0
ID: PostgreSQLdemo
version: 1.0.0
description: "A simple CAP project."
parameters:
  enable-parallel-deployments: true
  deploy_mode: html5-repo
build-parameters:
  before-all:
    - builder: custom
      commands:
        - npm ci
        - npx cds build --production
modules:
  - name: PostgreSQLdemo-srv
    type: nodejs
    path: gen/srv
    parameters:
      buildpack: nodejs_buildpack
      readiness-health-check-type: http
      readiness-health-check-http-endpoint: /health
    build-parameters:
      builder: npm
    provides:
      - name: srv-api # required by consumers of CAP services (e.g. approuter)
        properties:
          srv-url: ${default-url}
    requires:
      - name: PostgreSQLdemo-auth
      - name: PostgreSQLdemo-postgres
      - name: PostgreSQLdemo-messaging
      - name: PostgreSQLdemo-connectivity
      - name: PostgreSQLdemo-destination

  - name: PostgreSQLdemo-postgres-deployer
    type: nodejs
    path: gen/pg
    parameters:
      buildpack: nodejs_buildpack
      no-route: true
      no-start: true
      tasks:
        - name: deploy-to-postgresql
          command: npm start
    requires:
      - name: PostgreSQLdemo-postgres

  - name: PostgreSQLdemo
    type: approuter.nodejs
    path: app/router
    parameters:
      keep-existing-routes: true
      disk-quota: 256M
      memory: 256M
    requires:
      - name: srv-api
        group: destinations
        properties:
          name: srv-api # must be used in xs-app.json as well
          url: ~{srv-url}
          forwardAuthToken: true
      - name: PostgreSQLdemo-auth
      - name: PostgreSQLdemo-destination
      - name: PostgreSQLdemo-html5-runtime
      - name: PostgreSQLdemo-portal

  - name: PostgreSQLdemo-app-deployer
    type: com.sap.application.content
    path: gen
    requires:
      - name: PostgreSQLdemo-html5-repo-host
        parameters:
          content-target: true
    build-parameters:
      build-result: app/
      requires:
        - name: PostgreSQLdemoadminbooks
          artifacts:
            - admin-books.zip
          target-path: app/
        - name: PostgreSQLdemobrowse
          artifacts:
            - browse.zip
          target-path: app/

  - name: PostgreSQLdemoadminbooks
    type: html5
    path: app/admin-books
    build-parameters:
      build-result: dist
      builder: custom
      commands:
        - npm ci
        - npm run build
      supported-platforms:
        []
  - name: PostgreSQLdemobrowse
    type: html5
    path: app/browse
    build-parameters:
      build-result: dist
      builder: custom
      commands:
        - npm ci
        - npm run build
      supported-platforms:
        []

  - name: PostgreSQLdemo-portal-deployer
    type: com.sap.application.content
    path: app/portal
    requires:
      - name: PostgreSQLdemo-portal
        parameters:
          content-target: true
          service-key:
            name: PostgreSQLdemo-portal-key
            config:
              content-endpoint: developer
      - name: PostgreSQLdemo-auth
      - name: PostgreSQLdemo-html5-repo-host
      - name: PostgreSQLdemo-app-deployer
    deployed-after:
      - PostgreSQLdemo-app-deployer
  - name: notification-content-deployment
    type: nodejs
    path: gen/srv
    parameters:
      no-route: true
      no-start: true
      memory: 256MB
      disk-quota: 1GB
      tasks:
        - name: notification-content-deployment
          command: "node node_modules/@cap-js/notifications/lib/content-deployment.js"
          memory: 256MB
          disk-quota: 1GB
    requires:
      - name: PostgreSQLdemo-destination
      - name: PostgreSQLdemo-auth
      - name: PostgreSQLdemo-connectivity
      - name: PostgreSQLdemo-messaging

resources:
  - name: PostgreSQLdemo-auth
    type: org.cloudfoundry.managed-service
    parameters:
      service: xsuaa
      service-plan: application
      path: ./xs-security.json
      config:
        xsappname: PostgreSQLdemo-${org}-${space}
        tenant-mode: dedicated
  - name: PostgreSQLdemo-postgres
    type: org.cloudfoundry.managed-service
    parameters:
      service: postgresql-db
      service-plan: development
  - name: PostgreSQLdemo-messaging
    type: org.cloudfoundry.managed-service
    parameters:
      service: enterprise-messaging
      service-plan: default
      path: ./event-mesh.json
  - name: PostgreSQLdemo-connectivity
    type: org.cloudfoundry.managed-service
    parameters:
      service: connectivity
      service-plan: lite
  - name: PostgreSQLdemo-destination
    type: org.cloudfoundry.managed-service
    parameters:
      service: destination
      service-plan: lite
      config:
        HTML5Runtime_enabled: true
        init_data:
          instance:
            existing_destinations_policy: update
            destinations:
              - Name: PostgreSQLdemo-srv-api
                URL: ~{srv-api/srv-url}
                Authentication: NoAuthentication
                Type: HTTP
                ProxyType: Internet
                HTML5.ForwardAuthToken: true
                HTML5.DynamicDestination: true
              - Name: ui5
                URL: https://ui5.sap.com
                Authentication: NoAuthentication
                Type: HTTP
                ProxyType: Internet

  - name: PostgreSQLdemo-html5-repo-host
    type: org.cloudfoundry.managed-service
    parameters:
      service: html5-apps-repo
      service-plan: app-host
  - name: my-postgresql
    type: com.sap.xs.postgresql
    parameters:
      service-plan: hyperscaler
  - name: PostgreSQLdemo-html5-runtime
    type: org.cloudfoundry.managed-service
    parameters:
      service: html5-apps-repo
      service-plan: app-runtime
  - name: PostgreSQLdemo-portal
    type: org.cloudfoundry.managed-service
    parameters:
      service: portal
      service-plan: standard

and here is my package.json file

{
  "name": "PostgreSQLdemo",
  "version": "1.0.0",
  "description": "A simple CAP project.",
  "repository": "<Add your repository here>",
  "license": "UNLICENSED",
  "private": true,
  "dependencies": {
    "@cap-js/notifications": "*",
    "@cap-js/postgres": "^1.10.4",
    "@sap/cds": "^8",
    "@sap/xssec": "^4",
    "express": "^4"
  },
  "devDependencies": {
    "@cap-js/cds-types": "^0.7.0",
    "@cap-js/sqlite": "^1",
    "@sap/cds-dk": "^8"
  },
  "scripts": {
    "start": "cds-serve"
  },
  "sapux": [
    "app/admin-books",
    "app/browse"
  ],
  "cds": {
    "requires": {
      "auth": "mocked",
      "messaging": {
        "kind": "enterprise-messaging"
      },
      "db": {
        "kind": "postgres"
      },
      "connectivity": true,
      "destinations": true,
      "html5-repo": true,
      "portal": true
    }
  }
}

Please resolve this error

Accepted Solutions (0)

Answers (1)

Answers (1)

qinghao-liang
Product and Topic Expert
Product and Topic Expert

The error message itself explains the root cause clearly, you must have a package-lock.json file in your project. Following is from "npm ci" help document.

The main differences between using npm install and npm ci are:

  • The project must have an existing package-lock.json or npm-shrinkwrap.json.
  • If dependencies in the package lock do not match those in package.json, npm ci will exit with an error, instead of updating the package lock.