I want to remove the bluebird package installed in my sails app, in favor of the native Node promises.
But after I set npm remove bluebird --save
, I get:
Error: Cannot find module 'bluebird'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/candyvoice/node_modules/sails/node_modules/consolidate/lib/consolidate.js:22:15)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/candyvoice/node_modules/sails/node_modules/consolidate/index.js:1:80)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
I don't use bluebird anywhere in my code so I'm guessing this is somehow a Sails dependency? The stacktrace doesn't refer to any of my files either.
Thanks
Bluebird is a SailsJS dependency.
You can use native promises in your application alongside Sails' bluebird ones and it'll work seamlessly.
Bluebird has thousands of tests to ensure that its promises work seamlessly with native ones - and bluebird contributors are also NodeJS contributors that ensure it doesn't break from the other side either. (Full disclosure, I'm a bluebird contributor and a NodeJS collaborator).
Simply don't use bluebird in your own code - and things will work well :)
As a caveat, in NodeJS 8 there's a chance unhandled promise rejections will throw. You can fix this by setting process.on("unhandledRejection"
which will set the same behavior to all promises.