bower: bower init failing to bring the interactive prompt to create bower.json

After updating bower to 1.2.1, the bower init command seems to fail. When running the bower init the follow result is shown:

  • bower ENOINT Register requires interactive

Here is the Stack Trace when run in verbose mode:

bower ENOINT        Register requires interactive

Stack trace:
Error: Register requires interactive
    at createError (/usr/local/lib/node_modules/bower/lib/util/createError.js:4:15)
    at /usr/local/lib/node_modules/bower/lib/commands/init.js:24:34
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

Console trace:
Trace
    at StandardRenderer.error (/usr/local/lib/node_modules/bower/lib/renderers/StandardRenderer.js:74:17)
    at Logger.<anonymous> (/usr/local/lib/node_modules/bower/bin/bower:108:18)
    at Logger.EventEmitter.emit (events.js:96:17)
    at Logger.emit (/usr/local/lib/node_modules/bower/node_modules/bower-logger/lib/Logger.js:29:39)
    at /usr/local/lib/node_modules/bower/lib/commands/init.js:24:20
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

System info:
Bower version: 1.2.1
Node version: 0.8.19
OS: Darwin 13.0.0 x64

About this issue

  • Original URL
  • State: closed
  • Created 11 years ago
  • Comments: 38 (8 by maintainers)

Most upvoted comments

@IshanDemon running ‘bower init’ works on windows cmd (but did not work with git bash command line for a mysterious reason). thanks!

If you are using windows run bower init using CMD

OR

if you are using git bash follow these steps:

  1. Uninstall existing GIT bash
  2. Reinstall GIT bash
  3. Set up during installation: 3a: Select> Use Git form the Windows Command Prompt 3b: Select> Checkout Windows-style, commit Unix-style line endings 3c: Select> Use Windows’ default console window

do this from the run command cmd.exe /C “C:\Program Files\Git\bin\bash.exe” --login -i then bower init will work and you can do everything in minw64, mintty, or git-bash whatever it is called.

This is still an issue w/ bower 1.8.0 on git version 2.10.1.windows.1

Using cmd over git bash is not a fix,… it’s a step backwards.

Will try some of the following solutions mentioned above and report back.

Does not work with cygwin. Tried bower init firstly, then bower init --config.interactive.

$ bower init --config.interactive
bower error         Cannot read property 'substring' of undefined

Stack trace:
TypeError: Cannot read property 'substring' of undefined
    at Interface.rl._getCursorPos (C:\Program Files\nodejs\node_modules\bower\no     de_modules\inquirer\node_modules\readline2\index.js:51:51)
    at ScreenManager.render (C:\Program Files\nodejs\node_modules\bower\node_mod     ules\inquirer\lib\utils\screen-manager.js:19:27)
    at Prompt.render (C:\Program Files\nodejs\node_modules\bower\node_modules\in     quirer\lib\prompts\input.js:75:15)
    at Prompt._run (C:\Program Files\nodejs\node_modules\bower\node_modules\inqu     irer\lib\prompts\input.js:49:8)
    at Prompt.run (C:\Program Files\nodejs\node_modules\bower\node_modules\inqui     rer\lib\prompts\base.js:57:8)
    at Object.<anonymous> (C:\Program Files\nodejs\node_modules\bower\node_modul     es\inquirer\lib\ui\prompt.js:84:12)
    at module.exports (C:\Program Files\nodejs\node_modules\bower\node_modules\i     nquirer\node_modules\run-async\index.js:15:21)
    at AnonymousObservable.__subscribe (C:\Program Files\nodejs\node_modules\bow     er\node_modules\inquirer\lib\utils\utils.js:16:7)
    at AnonymousObservable.tryCatcher (C:\Program Files\nodejs\node_modules\bowe     r\node_modules\inquirer\node_modules\rx-lite\rx.lite.js:63:31)
    at setDisposable (C:\Program Files\nodejs\node_modules\bower\node_modules\in     quirer\node_modules\rx-lite\rx.lite.js:5741:44)

Console trace:
Error
    at StandardRenderer.error (C:\Program Files\nodejs\node_modules\bower\lib\re     nderers\StandardRenderer.js:82:37)
    at Logger.<anonymous> (C:\Program Files\nodejs\node_modules\bower\bin\bower:     110:22)
    at emitOne (events.js:77:13)
    at Logger.emit (events.js:169:7)
    at Logger.emit (C:\Program Files\nodejs\node_modules\bower\node_modules\bowe     r-logger\lib\Logger.js:29:39)
    at C:\Program Files\nodejs\node_modules\bower\lib\commands\index.js:48:20
    at _rejected (C:\Program Files\nodejs\node_modules\bower\node_modules\q\q.js     :844:24)
    at C:\Program Files\nodejs\node_modules\bower\node_modules\q\q.js:870:30
    at Promise.when (C:\Program Files\nodejs\node_modules\bower\node_modules\q\q     .js:1122:31)
    at Promise.promise.promiseDispatch (C:\Program Files\nodejs\node_modules\bow     er\node_modules\q\q.js:788:41)
System info:
Bower version: 1.6.7
Node version: 4.1.2
OS: Windows_NT 10.0.10240 x64

+1 same here when using cygwin shell. In cmd all works fine.

danila.shutov@o109 ~/lab/faith/client
$ bower init
bower ENOINT        Register requires an interactive shell

Additional error details:
Note that you can manually force an interactive shell with --config.interactive

danila.shutov@o109 ~/lab/faith/client
$ bower init --config.interactive
bower error         Cannot read property 'substring' of undefined

Stack trace:
TypeError: Cannot read property 'substring' of undefined
    at Interface.rl._getCursorPos (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\node_modules\readline2\index.js:51:51)
    at ScreenManager.render (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\lib\utils\screen-manager.js:19:27)
    at Prompt.render (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\lib\prompts\input.js:75:15)
    at Prompt._run (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\lib\prompts\input.js:49:8)
    at Prompt.run (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\lib\prompts\base.js:57:8)
    at Object.<anonymous> (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\lib\ui\prompt.js:84:12)
    at module.exports (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\node_modules\run-async\index.js:15:21)
    at AnonymousObservable.__subscribe (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\lib\utils\utils.js:16:7)
    at AnonymousObservable.tryCatcher (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\node_modules\rx-lite\rx.lite.js:63:31)
    at setDisposable (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\inquirer\node_modules\rx-lite\rx.lite.js:5741:44)

Console trace:
Error
    at StandardRenderer.error (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\lib\renderers\StandardRenderer.js:83:37)
    at Logger.<anonymous> (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\bin\bower:116:30)
    at emitOne (events.js:77:13)
    at Logger.emit (events.js:169:7)
    at Logger.emit (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\bower-logger\lib\Logger.js:29:39)
    at C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\lib\commands\index.js:48:20
    at _rejected (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:844:24)
    at C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:870:30
    at Promise.when (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:1122:31)
    at Promise.promise.promiseDispatch (C:\Users\danila.shutov\AppData\Roaming\npm\node_modules\bower\node_modules\q\q.js:788:41)
System info:
Bower version: 1.7.1
Node version: 4.2.1
OS: Windows_NT 10.0.10240 x64

i met it today。the way i slove it is using windows cmd instead of git bash.It worked! enjoy it. buddy

I’ve tried to downgrade the version to bower 0.10.0 but it doesn’t work well. The bower init configuration works fine for few seconds then it hangs up your terminal. The solution is found in on its documentation. It’s not supporting MinTTY which causes this problem. Here is the solution:

  1. Uninstall existing GIT bash
  2. Reinstall GIT bash
  3. Set up during installation: 3a: Select> Use Git form the Windows Command Prompt 3b: Select> Checkout Windows-style, commit Unix-style line endings 3c: Select> Use Windows’ default console window

Hey @jinmatt!

  1. What terminal are you using?
  2. Are you using bower through a regular install (npm install bower -g) or are you actually have it cloned locally and npm link?

In case you have a linked copy of bower in 2. you have to do npm install inside the cloned bower directory.

The interactive flag is being set here: https://github.com/bower/bower/blob/master/lib/config.js#L11 you can debug that with a console.log(config) before the if statement and one afterwards, including process.title and isatty.

Note that you can enable it anyway with --config.interactive, but worth investigating why your terminal is not a reporting itself as a tty.

I’m having this problem with bower in cygwin. This used to work some time ago, but for some reason it stopped after upgrading to the latest version.

I have the same problem 😢 with Git Bash, but it works well with cmd