Aurelia Frontend: Module not found: Error: Can't resolve 'async_hooks' in bluebirdjs

If you are using the @dolittle/build.aurelia package, you may encounter this error when trying to build your frontends with the latest versions of bluebird (v.3.6.0 & 3.7.0).

Console Output:

ERROR in ./node_modules/bluebird/js/release/promise.js
Module not found: Error: Can't resolve 'async_hooks' in '/ProjectPath/Web/node_modules/bluebird/js/release'
 @ ./node_modules/bluebird/js/release/promise.js 34:4-26
 @ ./node_modules/bluebird/js/release/promise.js-exposed
 @ ./node_modules/bluebird/js/release/bluebird.js
 @ ./node_modules/bluebird/js/release/bluebird.js-exposed


Clamp down the version of bluebird in your project’s package.json to v.3.5.5 by running this command in your Web folder:

npm install bluebird@3.5.5

or to the highest patch v3.5.x

npm install bluebird@~3.5.5

Longer Term Fix

We need to figure out why this error is occurring, and see if there’s something that can be resolved in the build-backage. I also see that Aurelia have moved away from bluebird in their official boilerplates, so perhaps this could also be something to consider.


Thans for this Tip @pavneet!

I tried to spin a bit on the last part you’re writing there. So I removed all Bluebird stuff from @dolittle/build.aurelia and from main.js in my app. It builds without any errors. But I don’t know how it will impact the app in function.

1 Like

Great to hear @Vidar! I think you’ve described the default behaviour in most modern browsers. They mostly support native promises:

Aurelia has officially moved over to use polyfill-promise package. I think it’s mostly relevant for IE11 support, these days.

Perhaps we could move the IE support to a separate package you need to opt-in to? Ex @dolittle/ Alternatively just document the needed steps required to add the polyfill in your project.

Hey @pavneet, I tested the updated package now, 3.3.1, with Bluebird ~3.5.5. But I still get the error. Should I try updating it and lock it up to 3.5.5 without the ~ ?

Could you check the lock files (yarn.lock or package-lock.json) to see which version it actually resolves to?

I don’t quite know what in the lock file says what it resolved, but I’m guessing that the ones at root level is what we’re looking for?

bluebird@^3.3.0, bluebird@^3.5.5:
  version "3.7.1"
  resolved ""
  integrity sha512-DdmyoGCleJnkbp3nkbxTLJ18rjDsE4yCggEwKNXkeV123sPNfOCYeDoeuOY+F2FrSjO1YXcTU+dsy96KMy+gcg==

  version "3.5.5"
  resolved ""
  integrity sha512-5am6HnnfN+urzt4yfg7IgTbotDjIT/u8AJpEt0sIU9FtXfVeezXAPKswrG+xKUCOYAINpSdgZVDU6QFh+cuH3w==

The places where it’s a dependency, is these:

    bluebird "~3.5.5"

    bluebird "^3.5.5"

    bluebird "^3.5.5"

    bluebird "^3.3.0"
1 Like

OK, so setting the version to ~3.5.5 doesn’t have the desired effect. Perhaps setting it to 3.5.5 explicitly will do the trick?

For reference, this is the issue on github:

As the github issue is 404’d, is this now fixed? I’m still getting this error with using the newest @dolittle/boilerplates.interaction.web.ts.aurelia@2.0.0 boilerplate while explicitly importing bluebirdinto my code.
Running npm list bluebird on it I get:

Here’s a new issue

1 Like

Ok so you shouldn’t be using bluebird nowadays. This error popped up with old code that I’m updating and that old code used to import bluebird, creating this error.

1 Like

Yea, was more or less the conclusion in the 404’d thread. Not sure where that disappeared to. Thanks for updating here @Joel!