unable to build frontend: Error [ERR_REQUIRE_ESM]: require() of ES Module is not supprted
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
@Saschl your account got pwnd?
@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
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.