Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bower init failing to bring the interactive prompt to create bower.json #802

Closed
jinmatt opened this issue Aug 20, 2013 · 38 comments
Closed
Labels

Comments

@jinmatt
Copy link

jinmatt commented Aug 20, 2013

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
@satazor
Copy link
Member

satazor commented Aug 20, 2013

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.

@jinmatt
Copy link
Author

jinmatt commented Aug 20, 2013

@satazor
I'm using oh-my-zsh. I have installed bower using npm(npm install -g bower), and updated bower lately using npm update -g bower

@satazor
Copy link
Member

satazor commented Aug 20, 2013

@jinmatt I've tried oh-my-zsh and it works. Can you try to uninstall bower and install it again?

@jinmatt
Copy link
Author

jinmatt commented Aug 20, 2013

Tried that, but getting the same result again.

@jinmatt
Copy link
Author

jinmatt commented Aug 20, 2013

Uninstalled bower 1.2.1 and installed 0.10.0, and now bower init is working.

@satazor
Copy link
Member

satazor commented Aug 20, 2013

@jinmatt the only difference I'm having is that I was running on MacOSx. Anyway, I will remove that check on the init command and release a new version today. I advise against downgrading to 0.10.0. Bower <1.0.0 has a lot of issues.

@satazor satazor closed this as completed Aug 20, 2013
@satazor satazor reopened this Aug 20, 2013
@satazor
Copy link
Member

satazor commented Aug 20, 2013

Oops didn't wanted to close.

@jinmatt anyway, even if I remove that check, you will be running bower with interactive set to false, meaning it won't prompt you questions whenever necessary.

Can you please do the following:

$ node
var tty = require('tty');
tty.isatty(1);

What does it output?

@satazor
Copy link
Member

satazor commented Aug 21, 2013

Bump.

@jinmatt
Copy link
Author

jinmatt commented Aug 21, 2013

@satazor
the output I get:

> var tty = require('tty');
undefined
> tty.isatty(1);
true

@jinmatt
Copy link
Author

jinmatt commented Aug 21, 2013

@satazor btw I'm too running on a Mac OS X. But on 10.9 Preview 5, do you think this might be a cause of this issue?

@jinmatt
Copy link
Author

jinmatt commented Aug 21, 2013

Updated to 1.2.2 now. Now when I run bower init I get this Additional error details

bower ENOINT        Register requires an interactive shell

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

So I tried running bower init --config.interactive and the interactive prompt is working

@satazor
Copy link
Member

satazor commented Aug 21, 2013

Yes I've improved the error message. Still I would like to know why this is happening to you, since it can be affecting other users. Can you please do the following:

@jinmatt
Copy link
Author

jinmatt commented Aug 21, 2013

Done:

➜  bower git:(master) bower -v
{ cwd: '/Users/jinmatt/Documents/Workdesk/sandbox/bowerBox/bower',
  directory: 'bower_components',
  registry: 
   { search: [ 'https://bower.herokuapp.com' ],
     register: 'https://bower.herokuapp.com',
     publish: 'https://bower.herokuapp.com' },
  shorthandResolver: 'git://github.com/{{owner}}/{{package}}.git',
  tmp: '/var/folders/tf/rvwhrxms15x20gdxgggsy3zr0000gp/T/jinmatt/bower',
  timeout: 30000,
  ca: { search: [] },
  strictSsl: true,
  userAgent: 'node/v0.8.19 darwin x64',
  color: true,
  storage: 
   { packages: '/Users/jinmatt/.cache/bower/packages',
     links: '/Users/jinmatt/.local/share/bower/links',
     completion: '/Users/jinmatt/.local/share/bower/completion',
     registry: '/Users/jinmatt/.cache/bower/registry',
     empty: '/Users/jinmatt/.local/share/bower/empty' } }
1.2.2

@satazor
Copy link
Member

satazor commented Aug 21, 2013

Looks good.

Add console.log(config.interactive), console.log(process.title) and console.log(tty.isatty(1) to https://github.com/bower/bower/blob/master/lib/config.js#L11 and please report back.

@jinmatt
Copy link
Author

jinmatt commented Aug 21, 2013

Was going through the code, seems like I'm getting process.title = 'node' and not equal to 'bower' as expected to make config.interactive = true in config.js line 12. So if I change the string 'bower' to 'node', bower init works.

Here are the logs which you requested:

➜  bower git:(master) ✗ bower -v  
{ cwd: '/Users/jinmatt/Documents/Workdesk/sandbox/bowerBox/bower',
  directory: 'bower_components',
  registry: 
   { search: [ 'https://bower.herokuapp.com' ],
     register: 'https://bower.herokuapp.com',
     publish: 'https://bower.herokuapp.com' },
  shorthandResolver: 'git://github.com/{{owner}}/{{package}}.git',
  tmp: '/var/folders/tf/rvwhrxms15x20gdxgggsy3zr0000gp/T/jinmatt/bower',
  timeout: 30000,
  ca: { search: [] },
  strictSsl: true,
  userAgent: 'node/v0.8.19 darwin x64',
  color: true,
  storage: 
   { packages: '/Users/jinmatt/.cache/bower/packages',
     links: '/Users/jinmatt/.local/share/bower/links',
     completion: '/Users/jinmatt/.local/share/bower/completion',
     registry: '/Users/jinmatt/.cache/bower/registry',
     empty: '/Users/jinmatt/.local/share/bower/empty' } }
undefined
node
true
1.2.2

@jinmatt
Copy link
Author

jinmatt commented Aug 21, 2013

Seems like the version of node v0.8.19 I was running had this problem of setting process.title.
userAgent: 'node/v0.8.19 darwin x64'
Updated node to v0.10.16 stable, and problem solved! Now I get process.title = 'bower'.

@jinmatt
Copy link
Author

jinmatt commented Aug 22, 2013

@satazor : Just out of curiosity, why was the earlier version of bower working properly? The code wasn't checking for interactive auto, or wasn't checking the process title name?

@satazor
Copy link
Member

satazor commented Aug 22, 2013

@jinmatt the default was true, but it has changed to null (auto) later to be more accurate.

@chasetec
Copy link

This is still an issue when running under Cygwin.

@derekgreer
Copy link

Yep, running into this under Cygwin shell.

@derekgreer
Copy link

I've tracked this down to an issue with mintty.exe.

In the bower/lib/config.js file (line 34 for bower v 1.4.1), tty.isatty(1) returns false under mintty.exe, but true if you run cygwin.bat (which is bash --login -i using the Windows terminal).

Here's a convenient way to check your terminal:

node -e "var tty=require('tty'); console.log('tty.isatty(1):' + tty.isatty(1))"

Possibly related: https://code.google.com/p/mintty/issues/detail?id=56


For those stumbling across this issue looking for a solution, the obvious quick workaround for this issue is to simply avoid using mintty. This doesn't mean you have to return to using the Windows terminal for bash, as there are other alternatives. See http://blog.jaykanakiya.com/terminal-setup-in-windows-7/ and/or http://buildstarted.com/2012/05/11/replacing-default-git-bash-console-with-console2/ for instructions for configuring Console2 with bash. Turn off the menus, tool bars, and status bars, create a shortcut named "Cygwin" or "Bash", change the shortcut's icon to C:\cygwin64\Cygwin-Terminal.ico and you'll probably never know the difference.

P.S. If you've ever noted other issues with mintty.exe, like msysgit not prompting for a password properly or the node repl not working, this is probably the same issue.

@fooontic
Copy link

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

@iwozzy
Copy link

iwozzy commented Nov 27, 2015

Trying bower init in Cygwin and getting

bower ENOINT        Register requires an interactive shell

I've also tried bower init --config.interactive and getting

bower EINVAL        EINVAL, invalid argument

This is on Windows 10 while running Cygwin as Administrator.

@ghost
Copy link

ghost commented Dec 12, 2015

+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

@rosegbn
Copy link

rosegbn commented Dec 15, 2015

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

@AlexanderSuvorov
Copy link

Thank you dreamypixy. It's so sad cuz i like MinTTY.

@cataquil
Copy link

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.

@AlexanderSuvorov
Copy link

Thanks a lot cataquil. But it's still half desicion.

@heavybeard
Copy link

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

@steve-todorov
Copy link

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.

@IshanDemon
Copy link

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

@yonycat
Copy link

yonycat commented Mar 1, 2016

Hi, I encounter this bug too. When i use git bash,i encounter the seem issue。so i use windows cmd and fixed out this issue。 so if you os is windows,may be you can use cmd in place of git bash。

@shahard
Copy link

shahard commented Mar 19, 2016

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

@tomgets85
Copy link

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

@oneezy
Copy link

oneezy commented Dec 8, 2016

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.

@zeeshanjan82
Copy link

Getting the same issue: Register requires an interactive shell.

@Kranthi1547
Copy link

I still get error "Register requires an interactive shell" with git version 2.10.2.windows.1
and bower version 1.8.0.

@leotm
Copy link

leotm commented Jul 17, 2017

Same here as @Kranthi1547 . However, works in PowerShell.
(Win10Pro64, Git v2.11.1, Bower v1.8.0).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests