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

fix zsh node version autochange not installing node version #1357

Merged
merged 1 commit into from
Jan 5, 2017
Merged

fix zsh node version autochange not installing node version #1357

merged 1 commit into from
Jan 5, 2017

Conversation

butlerx
Copy link
Contributor

@butlerx butlerx commented Dec 19, 2016

No description provided.

@ljharb
Copy link
Member

ljharb commented Dec 19, 2016

@PeterDaveHello (from #1306) - can you confirm that this is the correct fix?

@@ -322,7 +322,7 @@ load-nvmrc() {
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

if [ "$nvmrc_node_version" != "N/A" ] && [ "$nvmrc_node_version" != "$node_version" ]; then
if [ "$nvmrc_node_version" == "N/A" ] && [ "$nvmrc_node_version" != "$node_version" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's use a single = here

@PeterDaveHello
Copy link
Collaborator

I'll test it 👍

@PeterDaveHello
Copy link
Collaborator

I think putting nvm use in the else condition of the above if would be better since nvm install will also change the version, we don't need to do it twice, right?

@butlerx
Copy link
Contributor Author

butlerx commented Dec 21, 2016

yep that makes more sense

@butlerx
Copy link
Contributor Author

butlerx commented Jan 4, 2017

so is this good?

@@ -322,8 +322,10 @@ load-nvmrc() {
if [ -n "$nvmrc_path" ]; then
local nvmrc_node_version=$(nvm version "$(cat "${nvmrc_path}")")

if [ "$nvmrc_node_version" != "N/A" ] && [ "$nvmrc_node_version" != "$node_version" ]; then
if [ "$nvmrc_node_version" = "N/A" ] && [ "$nvmrc_node_version" != "$node_version" ]; then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the logic on this line says "if the nvmrc version is N/A and the node_version is not N/A", but nvm version doesn't print out N/A ever - so the second condition will always be true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep your right changed

@ljharb ljharb merged commit f1a5f2a into nvm-sh:master Jan 5, 2017
@butlerx butlerx deleted the bugfix/zsh-autoswitch branch January 5, 2017 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants