Closed Erwyn closed 7 years ago
Hey man :)
Are you using any other environment variable settings? If so could you paste them here.
Also, could you try disabling zsh-nvm
and manually source nvm
in a new session:
export NVM_DIR="$HOME/.nvm" # or wherever you've chosen to install it
source "$NVM_DIR/nvm.sh"
Then see if the correct Node.js version is loaded. That way we can see if it's zsh-nvm
specific issue or an issue with nvm
itself.
If it is an nvm
issue it might be worth running nvm upgrade
and see if that resolves it.
P.S currently relocating to Bali so might be a bit slow to respond over the next few days.
Hello @lukechilds
So, I'm using other variable settings, but I disabled them to test and still don't have the correct version loaded, so it does not seem related to it.
I tried the manual loading and I end up with this message:
nvm is not compatible with the npm config "prefix" option: currently set to "/home/martin/.nvm/versions/node/v7.5.0"
Run `npm config delete prefix` or `nvm use --delete-prefix v7.5.0 --silent` to unset it.
I don't have any idea of what this option is...
okay so with a bit of googling I found this: https://github.com/creationix/nvm/issues/855
I might get something out of it just let me check
no it was my fault I added a trailing slash in the NVM_DIR variable.
So result of this is, using directly nvm works. The correct version is loaded
Also just to "check" I added the export and source at the end of my .zshrc file and everything is working
Ok, good work, so it's definitely looking like a zsh-nvm
issue.
I've gotta be up early for a flight so I'm gonna have to drop this right now, feel free to submit a PR if you wanna have at bash at it. If not, I should be able to pick it up in a few days. 👍
Although I would really like to help you, I'm really not into bash programming. I already tried to check that the path was good in the script, and it is, and I tried to just enforce the source
with the complete path in the script which does not change anything, but If I do it in my .zshrc then I end up with the correct node version.
And don't worry, first of all you're already really kind to maintain this, and I'm using zsh-nvm with the NVM_NO_USE option, it's just that I came accross this issue and wanted to report it to you because this is the least I could do.
Okay, just a small experiment: removed everything from your plugin, just added one line: source /home/martin/.nvm/nvm.sh
Result is the same, there is the "load lagg" but I don't end up with the correct version of node.
Maybe something is wrong in my environment.
I don't think that's a reliable way to test. What plugin manager are you using? Many will have a cache file with all your plugins so editing the source file won't do anything.
So I'm on oh-my-zsh. For the editing part, adding an "echo" line works so I assumed it would work if I modify it. Plus when I removed everything just adding the source
line there was the "loading lagg" even if I have NVM_NO_USE
set to true so I assume it is not cached but I may be wrong.
Anyway, I'm on oh-my-zsh, you think this could be related?
I've tested on OMZ and it's working for me. It's possible it could be a conflict with one of your other OMZ plugins.
The fact that you've tried replacing the contents of the plugin with source /home/martin/.nvm/nvm.sh
and you still get the wrong version means it doesn't seem like it's an issue with zsh-nvm
. Sorry, I can't recreate the issue so there's not much more I can do to help.
Only thing i can recommend is to comment out OMZ and try another plugin manager like antigen just to test zsh-nvm
. If it still fails with antigen, it's most likely your OS env, if it works with antigen, it's most likely your OMZ setup.
Okay, thanks for the help!
No probs, good luck!
Feel free to re-open if you discover it is actually something in zsh-nvm
.
Hi,
I know this is closed, but I had this exact problem and found a solution that worked for me. I placed plugins+=(zsh-nvm)
at the end of my .zhrc file. Now it always loads my default version.
@lambrechts Thanks for posting your solution here. Hopefully it'll help somebody else who arrives here with the same problem.
Relevant XKCD: https://xkcd.com/979/
so true, Thanks lambrechts I'll try this
Hello again,
I noticed that even though I have the "lag" at the shell start, the correct version of node is not loaded:
And the NVM_NO_USE is not set.