-
Notifications
You must be signed in to change notification settings - Fork 20
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
Default version / .nvmrc not working #11
Comments
Thanks @jiaweihli, will have a look and let you know. |
same problem! fish 2.4 i cheated by: echo 'default' > ~/.nvmrc
echo 'nvm use' > ~/.config/fish.config but this is not ideal |
@jiaweihli Just a reminder that there is also: I use verman personally. |
@jiaweihli have you tried running @Lordnibbler why are you putting the
Et voilà now when you use node inside this folder, it will pick the .nvmrc and use that specific version. |
@FabioAntunes Yes, I've done that and it works correctly in bash - but not in fish. |
It does work correctly if I set |
@FabioAntunes Correct me if I am wrong, but isn't this precisely how nvm works? The tradeoff is between this extra second on every terminal or the manual extra step to run nvm yourself before using node. |
@jbucaran That's why I created this so whenever you use @jiaweihli I'm really sorry, but are you sure you have |
Sorry for radio silence. I've tried installing fisherman nvm as well as nvm, no luck. Let me know if there's any logs I can send you that would help you debug this. |
@jiaweihli Installing fisherman again will not fix anything, since fisherman is just a single function that goes into your ~/.config/fish/functions directory. There's nothing special or antyhing that deviates from standard fish, so perhaps there is an issue with your fish? :) Can you try using fnm / verman and let me know if the problem goes away? |
I have the exact same problem as @jiaweihli. If I understand @jbucaran’s comment above correctly, the 1 second that it takes NVM to run seems inevitable anyway? I certainly experience a 1 second lag when starting up bash, where the NVM script is configured to run. |
@fanaugen I'm a bit confused. This is fisherman/nvm. I understand this plugin was created so one can keep using nvm, as usual, with fish. Before this plugin, I made fnm, which does things differently, but also supports .nvmrc to ease with the migration. It's still supported and it has many users. Then, I made verman which is a configuration-only, much simpler approach, and it's what I use nowadays. @FabioAntunes Is nvm/node for you? Might want to upgrade your fish to 2.5 to see if anything breaks by the way. EDIT:
1 second lag, give or take is inevitable, but tapping into fish function autoloading, we can delay this lag to the moment we actually intend to use node, thus solving the slow shell start problem. This is implemented by creating a fish wrapper function around the node/npm (now yarn too?) binaries. This is how fnm and verman works and to some extend, fisherman/nvm, but you'll have to ask Fabio who is the author of fisherman/nvm for the details. |
Sorry for creating confusion. I was just trying to say that, as @jiaweihli pointed out, fisherman/nvm doesn’t "remember" the node version used across shell sessions. To reproduce:
Not sure whether this is intended behaviour, but the |
this worked fine for me:
then in a new terminal:
|
I also have this problem where opening a new shell will not switch to the default node version. I've uninstalled and re-installed nvm and fisher nvm but its still not working. Following the steps that @balupton mentioned above I also get a working node version, but not the version I have specified as my default when I used New terminal always shows:
Then I have to do:
|
This is getting really frustrating, I'm not able to reproduce this on my
machine. I'm going to format my machine during the weekend and with a fresh
install, maybe I will be able to reproduce this.
…On 24 May 2017 at 16:15, Tanc ***@***.***> wrote:
I also have this problem where opening a new shell will not switch to the
default node version. I've uninstalled and re-installed nvm and fisher nvm
but its still not working.
Following the steps that @balupton <https://github.com/balupton>
mentioned above I also get a working node version, but not the version I
have specified as my default when I used nvm alias default lts/argon
New terminal always shows:
$ node --version
v7.10.0
Then I have to do:
$ nvm use default
Now using node v4.8.3 (npm v2.15.11)
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#11 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACbUIcMZRFwH9-99UDP7RTPzBlzxAMflks5r9El1gaJpZM4LcBUO>
.
|
@tanc can you do me a favour? Run |
|
@tanc can you also run @jiaweihli @Lordnibbler @fanaugen Sorry for this late request, if you guys are still using this Package, could you guys run |
|
Ok, I discovered your problem @tanc, you have node installed outside of nvm, that makes node global available. So since you already have node on your $PATH, |
Fantastic, thanks @FabioAntunes I'll wait a couple of days and test your fix :) |
@tanc run |
Brilliant! Works great after update |
This removed the delay-on-new-terminal issue I was having as well, but I noticed an issue: ⋊> kevin at origin in ~ since Tue May 30 12:20:41
$ nvm current
system
⋊> kevin at origin in ~ since Tue May 30 12:20:43
$ cat ~/Desktop/test.js
#! /usr/bin/env node
console.log('hello world')
⋊> kevin at origin in ~ since Tue May 30 12:20:46
$ ~/Desktop/test.js
hello world
⋊> kevin at origin in ~ since Tue May 30 12:20:48
$ nvm current
system
⋊> kevin at origin in ~ since Tue May 30 12:20:51
$ node --version
Now using node v6.10.2 (npm v3.10.10)
v6.10.2
⋊> kevin at origin in ~ since Tue May 30 12:20:55
$ nvm current
v6.10.2
⋊> kevin at origin in ~ since Tue May 30 12:20:58
$ ~/Desktop/test.js
hello world
⋊> kevin at origin in ~ since Tue May 30 12:21:01
$ nvm current
v6.10.2 It looks like the node switching logic has been moved to the first instance of running If you're running a shell/python script that calls out to node, it might not be using the default version (if you just opened a new shell). |
Yep that's the point, to only source node when we need. You can either keep doing what you were doing, source nvm on shell init. Or you can create a command called node on some directory of yours.
Edit the file and paste this:
Add this line to your config.fish You can do it manually or by just running this
|
Also, in the freshly loaded shell. The globally installed packages for |
Hey guys, I'm on nvm 0.33.2 and I installed nvm through the zsh plugin. Default works fine, nvm use works fine, but the .nvmrc file does not work. I have a bunch of node versions all over the place so that might be my problem but when I call any ideas? |
@richardpringle check if in any of these files nvm is being autoloaded, this is the bit that does that:
if so you need to remove that. |
@FabioAntunes, thanks for the response! I just realized that I'm in the fisherman/nvm instead of creationix/nvm... woops! It actually appears as though I needed to call ^^^ |
I'm having this issue and I'm a bit confused. I've removed any instance of nvm sourcing from the files mentioned above and it doesn't seem to change anything. I currently can't even call
|
I actually soft linked to the same node version as my default alias in I'm sure one of the other commenters in this issue will correct me if I'm wrong. |
Is there any update on this issue? On a new shell, if I go to a folder with .nvmrc, calling node loads the correct version (as specified in that file), but if then I go to another folder with .nvmrc pointing to a different version, executing node does not switch to that version, I have to execute nvm use first. |
@lukiano that's the default behaviour check https://github.com/creationix/nvm#deeper-shell-integration If you want you can create some sort of script that listens for folder changes and checks if there's a |
Ok thanks, I didn't know that was the right behaviour. I'd certainly have a script that listens for folder changes, but also performs the lazy loading. It looks like the core of the magic is in |
Not sure why this is happening -
nvm
works well normally, but it's a pain to manually select a specific version every time.A new shell starts up with a node version of 'none'.
I've manually set a default version through
nvm
and verified that it works correctly in bash.I don't have a custom
$NVM_DIR
.The text was updated successfully, but these errors were encountered: