NPM CI and Bluebird promise warnings

Viewed 370

Short intro: We are starting to use npm ci for a more reliable installation of dependencies for our react application, instead of install. But we have been noticing some strange promise rejection behavior when using ci.


Description: When running npm ci in a node environment with NODE_ENV set to development, we receive hundreds of promise warnings from the Bluebird promise library:

(node:95984) Warning: .then() only accepts functions but was passed: [object Object]

I am curious whether these are coming from npm CI's code itself, as we have never seen these errors except when using npm CI.

You can also see in their source code that NPM is using Bluebird Promise library version 3.5.3.

To test this, I have incrementally removed all of the main and dev dependencies in our package.json, generating lock files and running npm ci to see if it originated from any specific packages, but it occurred every single time down to the last package (and alternate single packages).

I have also created an entirely separate npm repo and installed a package (react-scripts@latest), generated a lock file, and on running npm ci received the same promise warnings.

We were able to silence the errors on build by setting the environment variable BLUEBIRD_PROMISES=0 per the recommendations of this npm issue, and this did silence the warnings. But we would like to know why this is happening, and if there is something underlying these warnings that deserves more attention than simply silencing them.

Version info:
npm: 6.4.1
node: 10.15.0

1 Answers

I totally missed this (almost year old) question :]

But we would like to know why this is happening,

Bluebird has a warning feature where it warns against incorrect usage of promises. NPM uses bluebird internally and NPM has incorrect usage inside its own code base at some places.

The particular warning happens when you .then with a non-function which is likely an error.

and if there is something underlying these warnings that deserves more attention than simply silencing them.

You can silence them in general with environment variables or safely ignore them.

Related