Skip to content

Deployment getting failed for Migrated Fiori project #1057

Open

Description

@imran-sap

Expected Behavior

  • I've downloaded a SAP UI5 project from S4 system using report "UI5 Repository Load"
  • Imported the same into BAS account
  • After importing with help of Fiori migration tool added required dependency to it
  • Added deployment configs to it
  • It's working fine in "Preview Mode"
  • It should be deployed to S4 system using "npm run deploy" command

Current Behavior

  • "npm run deploy" or "npm run deploy-test" is getting failed with below error

**Message:
Unexpected token 's', "sap.ui.def"... is not valid JSON

Stack Trace:
SyntaxError: Unexpected token 's', "sap.ui.def"... is not valid JSON
at JSON.parse ()
at file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/processors/minifier.js:222:33**

Steps to Reproduce the Issue

  • I've downloaded a SAP UI5 project from S4 system using report "UI5 Repository Load"
  • Imported the same into BAS account
  • After importing with help of Fiori migration tool added required dependency to it
  • Added deployment configs to it
  • It's working fine in "Preview Mode"
  • It should be deployed to S4 system using "npm run deploy" command

Context

  • UI5 Module Version (output of ui5 --version when using the CLI): unknown
  • Node.js Version: unknown
  • npm Version: unknown
  • OS/Platform: unknown
  • Browser (if relevant): unknown
  • Other information regarding your environment (optional): nothing

Log Output / Stack Trace

0 verbose cli /local/asdf-inst-inbox-runtime/installs/nodejs/22.13.1/bin/node /home/user/.asdf-inst/installs/nodejs/22.13.1/bin/npm
1 info using npm@10.9.2
2 info using node@v22.13.1
3 silly config load:file:/local/asdf-inst-inbox-runtime/installs/nodejs/22.13.1/lib/node_modules/npm/npmrc
4 silly config load:file:/home/user/.npmrc
5 silly config load:file:/home/user/.node_modules_global/etc/npmrc
6 verbose title npm root
7 verbose argv "root" "--global"
8 verbose logfile logs-max:10 dir:/home/user/.npm/_logs/2025-05-14T13_04_55_234Z-
9 verbose logfile /home/user/.npm/_logs/2025-05-14T13_04_55_234Z-debug-0.log
10 verbose cwd /
11 verbose os Linux 6.6.63-cloud-amd64
12 verbose node v22.13.1
13 verbose npm v10.9.2
14 verbose exit 0
15 info ok

Message:
Unexpected token 's', "sap.ui.def"... is not valid JSON

Stack Trace:
SyntaxError: Unexpected token 's', "sap.ui.def"... is not valid JSON
at JSON.parse ()
at file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/processors/minifier.js:222:33
at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
at async Promise.all (index 34)
at async default (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/tasks/minify.js:32:29)
at async TaskRunner._executeTask (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/TaskRunner.js:447:3)
at async TaskRunner.runTasks (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/TaskRunner.js:124:5)
at async ProjectBuilder.build (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/ProjectBuilder.js:251:6)
at async ProjectGraph.build (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/graph/ProjectGraph.js:576:3)
at async Object.handleBuild [as handler] (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/lib/cli/commands/build.js:174:2)

Activity

  1. added
    needs triage
    on May 14, 2025
  2. RandomByte commented on May 14, 2025

    @RandomByte
    Member

    Please share the output of running the following two commands:

    • To retrieve the UI5 Tooling version: npm run deploy -- --version (should be similar to ui5 --version
    • To activate UI5 Tooling verbose logging (yours is showing the npm verbose log): npm run deploy -- --verbose (should be similar to ui5 build --verbose

    In general the error message seems to indicate that you have a JSON file containing JavaScript. The verbose log should give us more details on which file is the offending one.

  3. imran-sap commented on May 14, 2025

    @imran-sap
    Author

    Please share the output of running the following two commands:

    • To retrieve the UI5 Tooling version: npm run deploy -- --version (should be similar to ui5 --version
    • To activate UI5 Tooling verbose logging (yours is showing the npm verbose log): npm run deploy -- --verbose (should be similar to ui5 build --verbose

    In general the error message seems to indicate that you have a JSON file containing JavaScript. The verbose log should give us more details on which file is the offending one.

    Hi Merlin ..

    Getting the same issue while running these commands -

    user: zewm_lc_ui5_nok $ npm run deploy -- --version

    swan.pv.nok@0.0.1 deploy
    npm run build && fiori deploy --config ui5-deploy.yaml && rimraf archive.zip --version

    swan.pv.nok@0.0.1 build
    ui5 build -a --clean-dest --include-task=generateCachebusterInfo

    info ProjectBuilder Preparing build for project swan.pv.nok
    info ProjectBuilder Target directory: ./dist
    info ProjectBuilder Cleaning target directory...
    info Project 1 of 1: ❯ Building application project swan.pv.nok...
    info swan.pv.nok › Running task escapeNonAsciiCharacters...
    info swan.pv.nok › Running task replaceCopyright...
    info swan.pv.nok › Running task replaceVersion...
    info swan.pv.nok › Running task minify...
    error ProjectBuilder Build failed in 76 ms
    info ProjectBuilder Executing cleanup tasks...

    ⚠️ Process Failed With Error

    Error Message:
    Unexpected token 's', "sap.ui.def"... is not valid JSON

    Stack Trace:
    SyntaxError: Unexpected token 's', "sap.ui.def"... is not valid JSON
    at JSON.parse ()
    at file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/processors/minifier.js:222:33
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Promise.all (index 0)
    at async default (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/tasks/minify.js:32:29)
    at async TaskRunner._executeTask (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/TaskRunner.js:447:3)
    at async TaskRunner.runTasks (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/TaskRunner.js:124:5)
    at async ProjectBuilder.build (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/ProjectBuilder.js:251:6)
    at async ProjectGraph.build (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/graph/ProjectGraph.js:576:3)
    at async Object.handleBuild [as handler] (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/lib/cli/commands/build.js:174:2)

    user: zewm_lc_ui5_nok $ npm --version
    10.9.2

    user: zewm_lc_ui5_nok $ npm run deploy -- --verbose

    swan.pv.nok@0.0.1 deploy
    npm run build && fiori deploy --config ui5-deploy.yaml && rimraf archive.zip --verbose

    swan.pv.nok@0.0.1 build
    ui5 build -a --clean-dest --include-task=generateCachebusterInfo

    info ProjectBuilder Preparing build for project swan.pv.nok
    info ProjectBuilder Target directory: ./dist
    info ProjectBuilder Cleaning target directory...
    info Project 1 of 1: ❯ Building application project swan.pv.nok...
    info swan.pv.nok › Running task escapeNonAsciiCharacters...
    info swan.pv.nok › Running task replaceCopyright...
    info swan.pv.nok › Running task replaceVersion...
    info swan.pv.nok › Running task minify...
    error ProjectBuilder Build failed in 77 ms
    info ProjectBuilder Executing cleanup tasks...

    ⚠️ Process Failed With Error

    Error Message:
    Unexpected token 's', "sap.ui.def"... is not valid JSON

    Stack Trace:
    SyntaxError: Unexpected token 's', "sap.ui.def"... is not valid JSON
    at JSON.parse ()
    at file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/processors/minifier.js:222:33
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Promise.all (index 34)
    at async default (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/tasks/minify.js:32:29)
    at async TaskRunner._executeTask (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/TaskRunner.js:447:3)
    at async TaskRunner.runTasks (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/TaskRunner.js:124:5)
    at async ProjectBuilder.build (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/ProjectBuilder.js:251:6)
    at async ProjectGraph.build (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/graph/ProjectGraph.js:576:3)
    at async Object.handleBuild [as handler] (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/lib/cli/commands/build.js:174:2)

  4. RandomByte commented on May 14, 2025

    @RandomByte
    Member

    Thank you. The verbose logging still didn't get passed to the UI5 Tooling. Could you please try the following command and share the output?

    UI5_LOG_LEVEL=silly npm run deploy

    UI5_LOG_LVL=silly npm run deploy
    
  5. imran-sap commented on May 15, 2025

    @imran-sap
    Author

    UI5_LOG_LEVEL=silly npm run deploy

    Hi Merlin,

    This command as well not seems passed to UI5 tooling as I can see the same error, please find below the details --

    user: zewm_lc_ui5_nok $ UI5_LOG_LEVEL=silly npm run deploy

    **

    swan.pv.nok@0.0.1 deploy
    npm run build && fiori deploy --config ui5-deploy.yaml && rimraf archive.zip

    swan.pv.nok@0.0.1 build
    ui5 build -a --clean-dest --include-task=generateCachebusterInfo

    info ProjectBuilder Preparing build for project swan.pv.nok
    info ProjectBuilder Target directory: ./dist
    info ProjectBuilder Cleaning target directory...
    info Project 1 of 1: ❯ Building application project swan.pv.nok...
    info swan.pv.nok › Running task escapeNonAsciiCharacters...
    info swan.pv.nok › Running task replaceCopyright...
    info swan.pv.nok › Running task replaceVersion...
    info swan.pv.nok › Running task minify...
    error ProjectBuilder Build failed in 127 ms
    info ProjectBuilder Executing cleanup tasks...

    ⚠️ Process Failed With Error

    Error Message:
    Unexpected token 's', "sap.ui.def"... is not valid JSON

    Stack Trace:
    SyntaxError: Unexpected token 's', "sap.ui.def"... is not valid JSON
    at JSON.parse ()
    at file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/processors/minifier.js:222:33
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async Promise.all (index 3)
    at async default (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/builder/lib/tasks/minify.js:32:29)
    at async TaskRunner._executeTask (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/TaskRunner.js:447:3)
    at async TaskRunner.runTasks (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/TaskRunner.js:124:5)
    at async ProjectBuilder.build (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/build/ProjectBuilder.js:251:6)
    at async ProjectGraph.build (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/node_modules/@ui5/project/lib/graph/ProjectGraph.js:576:3)
    at async Object.handleBuild [as handler] (file:///home/user/projects/zewm_lc_ui5_nok/zewm_lc_ui5_nok/node_modules/@ui5/cli/lib/cli/commands/build.js:174:2)**

  6. RandomByte commented on May 15, 2025

    @RandomByte
    Member

    My apologies, I mistyped. It should be UI5_LOG_LVL (not UI5_LOG_LEVEL). Could you please try one more time with the command below?

    UI5_LOG_LVL=silly npm run deploy

    The log might get very large. Feel free to attach it as a file. We are most interested in the beginning and the end, but it's hard to say how many lines that would be, so maybe share the whole log if that's possible.

  7. imran-sap commented on May 15, 2025

    @imran-sap
    Author

    My apologies, I mistyped. It should be UI5_LOG_LVL (not UI5_LOG_LEVEL). Could you please try one more time with the command below?

    UI5_LOG_LVL=silly npm run deploy
    The log might get very large. Feel free to attach it as a file. We are most interested in the beginning and the end, but it's hard to say how many lines that would be, so maybe share the whole log if that's possible.

    Hi Merlin,

    Thanks for the support, Please find attached log file for your reference.

    Regards,
    Imran

    UI5_LOG_LVL=silly npm run deploy ZEWM_LC_UI5_NOK.txt

  8. RandomByte commented on May 15, 2025

    @RandomByte
    Member

    Thank you Imran.

    It looks like your project already contains files ending with .map as well as files ending with -dbg.js and even a Component-preload.js file.

    All of these are usually only found in the build output (i.e. what you deploy in your system). However in your case they seem to be part of the sources, and will therefore be treated like source code by UI5 Tooling.

    Normally this shouldn't really be an issue, the build will just take longer and you end up with a larger deployment and bundle size. However, in your case one of the .map files seems to not contain valid JSON, breaking the build.

    I'd propose to remove any files ending with .map and -dbg.js as well as the single Component-preload.js file from your project sources and try again. If you want to keep those files, check the .map files for containing valid JSON.

    If you experience further issues, and if you are a SAP customer, please report this issue for via https://support.sap.com for component CA-UI5-COR and attach your full project for further analysis.

    Please note that GitHub is a public platform and any information shared here can be accessed publicly by anyone.

  9. codeworrior commented on May 15, 2025

    @codeworrior
    Member

    @imran-sap I guess the issue is that you downloaded the project from the UI5 app repository in an S/4 system. That repo contains apps that are already built. If none of the follow-up steps (e.g. Fiori migration) transforms the project back into the "source shape", then issues like those described by @RandomByte, occur.

    If you want to bring the sources into "source shape", you might follow @RandomByte's suggestion with one small change:

    • instead of deleting the SomeFile-dbg.js or SomeController-dbg.controller.js, I would recommend to remove the file without the "-dbg" in its name and then rename the file with the "-dbg" by removing the "-dbg" part:
      • SomeController.controller.,js --> delete
      • SomeController-dbg.controller.js --> rename to SomeController.controller.js

    That way, you keep the documentation contained in the "-dbg" files.

    Cumbersome, I understand. I'm not familiar with the Fiori migration that you mentioned and whether it offers such steps already. AFAIK, something like this happens under the hood for adaptation projects (@MatthiasSchmalz can you confirm?).

  10. MatthiasSchmalz commented on May 16, 2025

    @MatthiasSchmalz

    Yes the adaptation project deals with the downloaded build results and recreates the preload files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs triage

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ Proxy