Require() of ES Module is not supported. UI5 tooling failed to start with server middleware
C3ntraX opened this issue · 4 comments
Expected Behavior
UI5-Tooling to start my app.
Current Behavior
I cann't start UI5-Tooling with any middleware or I get the following error:
Error Message:
require() of ES Module C:\Users*\node_modules\wrap-ansi\index.js from C:\Users*\node_modules\cliui\build\index.cjs not supported.
Instead change the require of index.js in C:\Users***\node_modules\cliui\build\index.cjs to a dynamic import() which is available in all CommonJS modules.
Stack Trace:
Error [ERR_REQUIRE_ESM]: require() of ES Module C:\Users*\node_modules\wrap-ansi\index.js from C:\Users*\node_modules\cliui\build\index.cjs not supported.
Instead change the require of index.js in C:\Users*\node_modules\cliui\build\index.cjs to a dynamic import() which is available in all CommonJS modules.
at Object. (C:\Users*\node_modules\cliui\build\index.cjs:293:14)
at Object. (C:\Users*\node_modules\yargs\build\index.cjs:1:60678)
at Object. (C:\Users*\node_modules\yargs\index.cjs:5:30)
at module.exports (C:\Users***\node_modules\ui5-middleware-livereload\lib\livereload.js:106:14)
Steps to Reproduce the Issue
Use the following settings:
specVersion: "3.0"
metadata:
name: erzeugniskalkulation
type: application
framework:
name: OpenUI5
version: "1.71.58"
libraries:
- name: sap.f
- name: sap.m
- name: sap.tnt
- name: sap.ui.core
- name: sap.ui.layout
- name: themelib_sap_belize
server:
settings:
httpPort: 3000
customMiddleware:
- name: ui5-middleware-livereload
afterMiddleware: compression
configuration:
debug: true
extraExts: "xml,json,properties"
port: 35730
watchPath: "webapp"
Context
- UI5 Module Version (output of
ui5 --version
when using the CLI):unknown
- Node.js Version:
v18.17.0
(Latest LTS) - npm Version:
9.6.7
- yarn Version:
v1.22.19
<--- Im using yarn to install dependencies - OS/Platform:
Windows
- Browser (if relevant):
Chrome
- Other information regarding your environment (optional):
nothing
Packages:
"devDependencies": {
"@ui5/cli": "3.3.1",
"ui5-middleware-livereload": "^3.0.0",
"ui5-middleware-simpleproxy": "^3.0.0",
"ui5-task-i18ncheck": "^3.0.0",
"ui5-tooling-stringreplace": "3.0.0",
"ui5-tooling-transpile": "3.0.1"
},
"scripts": {
"start": "ui5 serve --accept-remote-connections",
},
Log Output / Stack Trace
See above
It seeems that my yarn.lock had wrong resoultions. Dont know why but after I deleted the yarn.lock and let yarn to autogernerate a new yarn.lock, it works.
Hi @C3ntraX, thanks for reporting.
I tried to reproduce this issue by setting up a local project with the provided ui5.yaml
and the listed npm devDependencies
. Unfortunately I'm unable to reproduce the issue.
I attached my test project here:
ui5-tooling-issue-856.zip
Just execute npm install
and npm start
. The server should come up fine.
I can only suggest to delete the node_modules
directory and the package-lock.json
and yarn.lock
files in your project. Then reinstall all dependencies (maybe try npm first to rule out an issue with Yarn) and try again.
The error message sounds like a coding issue in one of the dependencies.
It seeems that my yarn.lock had wrong resoultions. Dont know why but after I deleted the yarn.lock and let yarn to autogernerate a new yarn.lock, it works.
Alright, glad to hear that 😄👌
Hi @RandomByte,
thanks for the fast response 👍 I think I already resolved this issue