wbyoung / avn

Automatic Version Switching for Node
MIT License
1.14k stars 54 forks source link

__avn_chpwd:local:1: not valid in this context error #36

Open apricot13 opened 8 years ago

apricot13 commented 8 years ago

I've just switched to zsh and am getting the following error when I load a directory with a .node_version file in it

__avn_chpwd:local:1: not valid in this context: Theatre/national-theatre-pp/.node-version

I have this in my .zshrc file (copied over from my .bashrc)

eval "$(rbenv init -)"
[[ -s "$HOME/.avn/bin/avn.sh" ]] && source "$HOME/.avn/bin/avn.sh" # load avn

can anyone point me in the right direction?

wbyoung commented 8 years ago

Can you try without the rbevn init to see if there's a conflict?

If no conflict, can you share what version of zsh, any addons, and on what OS you're running things?

apricot13 commented 8 years ago

Still no joy with rbenv commented out.

ZSH 5.1.1 OSX 10.10.4

no addons other than oh my zsh

wbyoung commented 8 years ago

Ok, the issue was with whitespace in the path name. I've got a branch up that you should be able to install & test. I want to add test coverage to this before merging, but don't have time right now. Please test with:

npm i -g wbyoung/avn#zsh-whitespace-dir
avn setup
apricot13 commented 8 years ago

no joy I'm afraid. I tried with and without rbenv commented out.

My .node-version just contains '0.12.7' is that correct - I couldn't find any example .node-version files anywhere!

wbyoung commented 8 years ago

@apricot13 yes, that's correct. The format is documented here. Can you please provide debugging output when using that branch?

apricot13 commented 8 years ago

using that branch the output is, I ran it before and after running nvm use 0.12.7 just in case!

hannahmacbook: ~/Projects/National Theatre/national-theatre-pp                                                                                                                                                    
→ __avn_debug
__avn_debug:local:1: not valid in this context: Theatre/national-theatre-pp/.node-version

Definitely doesn't like the spaces.

wbyoung commented 8 years ago

@apricot13 sorry, I had the sequence of commands slightly wrong before (I didn't update the version number on the branch, so avn didn't actually upgrade itself):

npm i -g 'wbyoung/avn#zsh-whitespace-dir'
rm -r ~/.avn
avn setup

Now open a new shell, cd to the folder & see what happens. __avn_debug if it doesn't work again.

apricot13 commented 8 years ago

you :star:, it works!

(also how do I get back to the main branch once your changes are merged in!?)

wbyoung commented 8 years ago

@apricot13 once merged & released, it'll just be updating as usual.