const rax = require('retry-axios');
Error [ERR_REQUIRE_ESM]: require() of ES Module
I was trying to implement a retry mechanism with retry-axios. After installing the package I got the Error [ERR_REQUIRE_ESM]: require() of ES Module error. I’m not too sure what this ESM is, I’ve never dealt with it before, therefore I don’t know what to do to fix this.
There're 2 main syntax of JS
Some library supports only one syntax, some supports both. You can check library's main syntax from package.json if there's field "type": "module" it means it supports only ESM syntax You may need to use some alternative library