frontend icon indicating copy to clipboard operation
frontend copied to clipboard

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

Open OlJohnny opened this issue 1 year ago • 1 comments

Checklist

  • [X] I have updated to the latest available Home Assistant version.
  • [X] I have cleared the cache of my browser.
  • [X] I have tried a different browser to see if it is related to my browser.
  • [X] I have tried reproducing the issue in safe mode to rule out problems with unsupported custom resources.

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 avatar Aug 26 '24 16:08 OlJohnny

@Saschl your account got pwnd?

OlJohnny avatar Aug 26 '24 17:08 OlJohnny

@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

Saschl avatar Aug 26 '24 19:08 Saschl

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub notifications, we have to clean some of the old issues, as many of them have already been resolved with the latest updates. Please make sure to update to the latest Home Assistant version and check if that solves the issue. Let us know if that works for you by adding a comment 👍 This issue has now been marked as stale and will be closed if no further activity occurs. Thank you for your contributions.

github-actions[bot] avatar Nov 24 '24 20:11 github-actions[bot]