2

Here's what happens - notice that the stack trace shows use of a global install of bluebird, which is of course a hint at the problem:

$foo/my-node-project

npm install
/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:61
        fn = function () { throw arg; };
                           ^

TypeError: Converting circular structure to JSON
    at JSON.stringify (<anonymous>)
    at process.target._send (internal/child_process.js:686:23)
    at process.target.send (internal/child_process.js:597:19)
    at callback (/usr/local/lib/node_modules/npm/node_modules/worker-farm/lib/child/index.js:32:17)
    at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
    at Promise.errorAdapter (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/nodeify.js:35:34)
    at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:566:21)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:689:18)
    at Async._drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16)
    at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10)
    at Immediate.Async.drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14)
    at runCallback (timers.js:763:18)

I was surprised to see these installs of bluebird:

$ npm ls -g bluebird
/usr/local/lib
├─┬ npm@5.6.0
│ ├─┬ bin-links@1.1.0
│ │ └── bluebird@3.5.1  deduped
│ ├── bluebird@3.5.1 
│ ├─┬ cacache@10.0.1
│ │ └── bluebird@3.5.1  deduped
│ ├─┬ npm-profile@2.0.5
│ │ └─┬ make-fetch-happen@2.5.0
│ │   └─┬ cacache@9.3.0
│ │     └── bluebird@3.5.1  deduped
│ └─┬ pacote@7.0.2
│   └── bluebird@3.5.1  deduped
└─┬ npx@9.7.1
  └─┬ npm@5.1.0
    ├── bluebird@3.5.0 
    ├─┬ cacache@9.2.9
    │ └── bluebird@3.5.0  deduped
    └─┬ pacote@2.7.38
      └── bluebird@3.5.0  deduped

The local node project does have bluebird, and it is a dependency of webpack:

$ npm ls bluebird
scorecards@1.0.0 /Users/foo/my-node-project
└─┬ html-webpack-plugin@2.30.1
  └── bluebird@3.5.1 

Seems like webpack ends up calling the wrong bluebird. Is this a problem with webpack not specifying the correct bluebird version to use then?

On the second run of npm i in this project, the error does not appear.

Obviously this is not a blocker, but I would like to understand what is going on to cause that first error.

christopherbalz
  • 722
  • 1
  • 8
  • 22

0 Answers0