Bit: prompt shows a warning on node >= v14.2.0

Created on 15 Jul 2020  Â·  2Comments  Â·  Source: teambit/bit

Describe the bug

When running a command that uses prompt, such as bit remove on node version v14.2.0 or above, it throws a warning.

Steps to Reproduce

  1. use node >= v14.2.0
  2. bit remove your-component

You'll get the following error:

➜  nm node --trace-warnings ~/teambit/bit/bin/bit.js remove bit.tmp1/foo-bar
are you sure you would like to proceed with this operation? (yes[y]/no[n])':  (node:3829) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
    at emitCircularRequireWarning (internal/modules/cjs/loader.js:823:11)
    at Object.get (internal/modules/cjs/loader.js:837:5)
    at Object.exports.setLevels (/Users/davidfirst/teambit/bit/node_modules/prompt/node_modules/winston/lib/winston/common.js:35:14)
    at Object.<anonymous> (/Users/davidfirst/teambit/bit/node_modules/prompt/node_modules/winston/lib/winston.js:84:8)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (/Users/davidfirst/teambit/bit/node_modules/prompt/lib/prompt.js:14:15)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19)

Expected Behavior

should show a prompt message asking you to enter yes/no.

Specifications

  • Bit version: 14.8.8
  • Node version: 14.2.0
  • npm / yarn version:
  • Platform:
  • Bit compiler (include version):
  • Bit tester (include version):

Additional context

This is happening due to the prompt package that requires an old version of Winston. See https://github.com/flatiron/prompt/issues/199 for more info.

Sadly, this package is not maintained. An alternative could be https://www.npmjs.com/package/enquirer or forking prompt and upgrading its Winston version.

typbug

Most helpful comment

We already use inquirer for some stuff like interactive.. We should just use it instead and remove prompt

All 2 comments

We already use inquirer for some stuff like interactive.. We should just use it instead and remove prompt

I'm new to bit and I found this really confusing as it occurred when I tried to export for the first time. It just looked like the export process had stalled.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KutnerUri picture KutnerUri  Â·  4Comments

KutnerUri picture KutnerUri  Â·  3Comments

odedre picture odedre  Â·  3Comments

KutnerBitsrc picture KutnerBitsrc  Â·  4Comments

JGJP picture JGJP  Â·  3Comments