Error when compiling Next.js app with intuit-oauth: the name `makeErrorCause` is defined multiple times

121 views Asked by At

I am building a Next.js app and using the library intuit-oauth. I have used this library in Express.js apps without any issues, but for some reason when I try to use it in a Next.js app, I get the following error:

Error: 
  x the name `makeErrorCause` is defined multiple times
    ,-[/Users/alan/Repositories/balancer/balancer-next/node_modules/make-error-cause/dist/index.js:5:1]
  5 |     d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6 | };
  7 | var makeError = require('make-error');
  8 | function makeErrorCause(value, _super) {
    :          ^^^^^^^|^^^^^^
    :                 `-- previous definition of `makeErrorCause` here
  9 |     if (_super === void 0) { _super = makeErrorCause.BaseError; }
 10 |     return makeError(value, _super);
 11 | }
 12 | var makeErrorCause;
    :     ^^^^^^^|^^^^^^
    :            `-- `makeErrorCause` redefined here
 13 | (function (makeErrorCause) {
 14 |     var BaseError = (function (_super) {
 15 |         __extends(BaseError, _super);
    `----

When I drill down in to the make-error-cause library, the name makeErrorCause is indeed defined multiple times, this is straight from the index.js file:

function makeErrorCause(value, _super) {
    if (_super === void 0) { _super = makeErrorCause.BaseError; }
    return makeError(value, _super);
}
var makeErrorCause;

Not sure why they did that, but Next.js doesn't like it. The chain of dependencies is intuit-oauth -> popsicle -> make-error -> make-error-cause

Any idea how to resolve this?

0

There are 0 answers