Repository navigation
Description
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 --versionwhen 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
RandomByte commentedon May 14, 2025
Please share the output of running the following two commands:
npm run deploy -- --version(should be similar toui5 --versionnpm run deploy -- --verbose(should be similar toui5 build --verboseIn 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.
imran-sap commentedon May 14, 2025
Hi Merlin ..
Getting the same issue while running these commands -
user: zewm_lc_ui5_nok $ npm run deploy -- --version
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...
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
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...
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)
RandomByte commentedon May 14, 2025
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 deployimran-sap commentedon May 15, 2025
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
**
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...
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)**
RandomByte commentedon May 15, 2025
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?
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.
imran-sap commentedon May 15, 2025
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
RandomByte commentedon May 15, 2025
Thank you Imran.
It looks like your project already contains files ending with
.mapas well as files ending with-dbg.jsand even aComponent-preload.jsfile.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
.mapfiles seems to not contain valid JSON, breaking the build.I'd propose to remove any files ending with
.mapand-dbg.jsas well as the singleComponent-preload.jsfile from your project sources and try again. If you want to keep those files, check the.mapfiles 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-CORand 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.
codeworrior commentedon May 15, 2025
@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:
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?).
MatthiasSchmalz commentedon May 16, 2025
Yes the adaptation project deals with the downloaded build results and recreates the preload files.