request-promise: RP2.0, in browser - Error when importing request-promise as an ES6 module

When I attempt to import request-promise into my web app I get the following error (using Browserify and Babel to transpile):

Cannot find module 'cls-bluebird' from '/Users/Bobby/Documents/Development/mediabase/node_modules/request-promise/lib'

My package.json (snipped) is as follows:

  "devDependencies": {
    "babel-preset-es2015": "^6.5.0",
    "babel-preset-react": "^6.5.0",
    "babelify": "^7.2.0",
    "browserify": "^13.0.0",
    "del": "^2.2.0",
    "gulp": "^3.9.1",
    "gulp-concat": "^2.6.0",
    "gulp-connect": "^2.3.1",
    "gulp-less": "^3.0.5",
    "history": "^1.17.0",
    "normalize-css": "^2.3.1",
    "react": "^0.14.7",
    "react-dom": "^0.14.7",
    "react-router": "^1.0.3",
    "vinyl-buffer": "^1.0.0",
    "vinyl-source-stream": "^1.1.0"
  },
  "dependencies": {
    "express": "^4.13.4",
    "request-promise": "2.0.0"
  }

Commenting out the request.bindCLS line in the library seems to fix the issue with no adverse affect on request-promise. If I use a standard require() to load the module I get the same issue. Do I need to include cls-bluebird as a dependency ? I thought this was removed …

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 8
  • Comments: 16 (8 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks @fotinakis !

I will remove cls-bluebird with the next release in a few weeks. (And there will be an alternative way for those who actually need cls-bluebird.)

Hey buddies, I just released request-promise@4.0.0 that dropped the whole cls-bluebird part. You should have no issues with webpack and browserify anymore.

Thanks everyone for providing workarounds until now.

@nathanph Thanks for the info!

Well, having the cls-bluebird dependency obviously turned out to be a pita to begin with. I am currently working on the next version of Request-Promise. In this version cls-bluebird will be dropped altogether. So imho it is best to wait for this version rather than trying to find a better fix for the existing mess… 😉

Hi thanks for the updates:

For the benefit of others using Browserify the ignoreMissing / ignore-missing flag did the trick for me as a temporary workaround.

Alternatively:

bundler.ignore('cls-bluebird');