home-assistant / frontend

:lollipop: Frontend for Home Assistant
https://demo.home-assistant.io
Other
3.96k stars 2.68k forks source link

unable to build frontend: Error [ERR_REQUIRE_ESM]: require() of ES Module is not supprted #21797

Open OlJohnny opened 2 weeks ago

OlJohnny commented 2 weeks ago

Checklist

Describe the issue you are experiencing

i am trying to setup this repsitory for developing. after following the documentation here, i get the following error during the step script/setup_translations:

/home/johnny/git_local/frontend/node_modules/string-width/index.js:2
const stripAnsi = require('strip-ansi');
                  ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /home/johnny/git_local/frontend/node_modules/strip-ansi/index.js from /home/johnny/git_local/frontend/node_modules/string-width/index.js not supported.
Instead change the require of /home/johnny/git_local/frontend/node_modules/strip-ansi/index.js in /home/johnny/git_local/frontend/node_modules/string-width/index.js to a dynamic import() which is available in all CommonJS modules.
    at Object. (/home/johnny/git_local/frontend/node_modules/string-width/index.js:2:19) {
  code: 'ERR_REQUIRE_ESM'
}

Node.js v20.17.0

nvm version: 0.39.3 node version: v20.17.0 npm version: 10.8.2 yarn version: 4.4.0

Describe the behavior you expected

error while building

Steps to reproduce the issue

see above

What version of Home Assistant Core has the issue?

-

What was the last working version of Home Assistant Core?

-

In which browser are you experiencing the issue with?

-

Which operating system are you using to run this browser?

-

State of relevant entities

No response

Problem-relevant frontend configuration

No response

Javascript errors shown in your browser console/inspector

No response

Additional information

No response

OlJohnny commented 2 weeks ago

@Saschl your account got pwnd?

Saschl commented 2 weeks ago

@Saschl your account got pwnd?

Yep, very sorry about that. Was not cautious enough when trying to submit the sample to MS as defender did not detect it.. lessons learned