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

'command not found' prompting after every command execution #192

Closed
daniel020403 opened this issue Jan 13, 2017 · 8 comments
Closed

'command not found' prompting after every command execution #192

daniel020403 opened this issue Jan 13, 2017 · 8 comments

Comments

@daniel020403
Copy link

daniel020403 commented Jan 13, 2017

Hello,

I just changed my zsh theme today to bullet train and I noticed that it prompts the message below upon starting the terminal and after every command execution.

prompt_nvm:6: command not found: node

Herewith attached is a screenshot of it.
screenshot at jan 13 14-19-02

Cheers!

@dawikur
Copy link
Collaborator

dawikur commented Jan 13, 2017

Do you want to see nvm/node segment?
If yes - you need to install node.
If no - you need to remove it from BULLETTRAIN_PROMPT_ORDER variable. (see https://github.com/caiogondim/bullet-train-oh-my-zsh-theme/wiki/Tips#bullettrain_prompt_order)

@dbanetto
Copy link

I just got this too & just removed it BULLETTRAIN_PROMPT_ORDER.

IMHO it is quite annoying from a user's perspective that nvm doesn't follow ruby's behaviour of only showing when the version manager has changed it & not showing the system version all the time.

@vadviktor
Copy link
Collaborator

@zyphrus it divides users' requirements at some point which is (I think) harder to implement: some would only like the prompt to appear in project directories, and others would want to see them all the time, to see if they want an adhoc REPL then which version are they going to use.

Your concern about the features not working in a consistent way is real and thanks for bringing that up.

@madpipeline
Copy link

Why can't is check if npm is installed, and if not, disable it in the prompt?

@evadeflow
Copy link

evadeflow commented Feb 27, 2017

I just spent an embarrassing amount of time figuring out how to only remove nvm from BULLETTRAIN_PROMPT_ORDER instead of explicitly setting it to a list of values. My rationale was that new elements—corresponding to new features of the theme—would be added to the default list in the future, and I might never know about them because I was overriding BULLETTRAIN_PROMPT_ORDER explicitly. I'm not altogether certain this is a legitimate concern, but here's what I appended to my .zshrc to remove the nvm entry and leave the rest alone:

BULLETTRAIN_PROMPT_ORDER=($(echo ${BULLETTRAIN_PROMPT_ORDER[@]/nvm}))

I'm sure shell ninjas will spot several edge cases where this wouldn't work as expected, but I guess it's good enough for my current purposes. The biggest potential problem I see is that the pattern matching isn't restricted to word boundaries, so it could, conceivably, modify more than one entry. But I'm not too concerned about it because the breakage in this case is loud:

$ echo $BULLETTRAIN_PROMPT_ORDER
time status custom context dir perl ruby virtualenv go git hg cmd_exec_time

$ BULLETTRAIN_PROMPT_ORDER=($(echo ${BULLETTRAIN_PROMPT_ORDER[@]/g}))
build_prompt:4: command not found: prompt_o                                                                                                                                                                         
build_prompt:4: command not found: prompt_it
build_prompt:4: command not found: prompt_h

$ echo $BULLETTRAIN_PROMPT_ORDER                                     
time status custom context dir perl ruby virtualenv o it h cmd_exec_time
build_prompt:4: command not found: prompt_o                                                                                                                                                                         
build_prompt:4: command not found: prompt_it
build_prompt:4: command not found: prompt_h

If anybody can tell me how to restrict the match to word boundaries, I'd be much obliged.

UPDATE

This seems to do the trick:

BULLETTRAIN_PROMPT_ORDER=($(echo ${BULLETTRAIN_PROMPT_ORDER[@]/#%nvm}))

It (still) operates on each element, but adding #% to the beginning of the pattern means it will only match elements that are identically equal to nvm, not items like nvm-pre, nvm-post or similar. (Discovered this ZSH feature by digging around on this page.)

@bicarbonate
Copy link

Does installing node require a reboot before the error stops?

@ghost
Copy link

ghost commented Apr 20, 2017

opening a new console should solve it. if not, try reloging in.

@dawikur
Copy link
Collaborator

dawikur commented May 16, 2017

This is connected to #212 - closing in favor of it.

@dawikur dawikur closed this as completed May 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants