SAP/ui5-tooling

Unexpected identifier 'assert' related with Node v22.7.0

Closed this issue · 2 comments

Expected Behavior

Project is running locally

Current Behavior

Fails with the following error when I run ui5 serve --port 3000 --config ui5-local.yaml --open index.html

> sct-master-data-ui@0.0.1 start:local
> ui5 serve --port 3000 --config ui5-local.yaml --open index.html

info graph:helpers:ui5Framework Using SAPUI5 version: 1.127.0

⚠️   Process Failed With Error

Error Message:
Unexpected identifier 'assert'

Stack Trace:
SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:166:18)
    at callTranslator (node:internal/modules/esm/loader:436:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:442:30)

Steps to Reproduce the Issue

  1. Clone repo (internal URL removed by MB)
  2. Run it locally npm run start:local

Context

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

Log Output / Stack Trace

{...}

Thanks for reporting @thecoldstone

Looks like we missed a deprecation in V8: https://v8.dev/features/import-attributes

We'll prepare a fix. Until then, please downgrade to an older Node.js release.

Looks like I jumped the gun on this one.

I actually can't reproduce this issue using Node.js 22.7.0 and UI5 CLI v3.11.1 or the latest v4.0.5. I also couldn't find code that still makes use the import assert keyword. I think we removed affected code a while ago.

I disabled the configured custom middleware in your project one by one to test which one is causing the error. It looks like the "dwc" middleware is the culprit. Please contact the maintainers of that package directly as it is not in our responsibility.

Also please keep in mind that github.com is a public platform. Therefore you must not post any internal URLs. I have removed the URL from your post.