-
-
Notifications
You must be signed in to change notification settings - Fork 8k
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
NVM in fish #303
Comments
May I request that this issue be reformatted in the form of a bug?
|
I attempted to test this out - I'm not sure if a script can be portable across bash/sh/dash/ksh and still work in fish. For example, Most worrying, all the other shells' function syntax doesn't work in fish. I suspect we'd need a brand new |
Not a self-promotion, but I did port nvm to fish, please check https://github.com/Alex7Kom/nvm-fish |
@alex7kom does your port share the same env vars and directory of node versions and global modules that standard |
@ljharb I tried to make it as close to standard |
@alex7kom This is great! I wanted to implement nvm for fish, but never found the time to learn fish well enough to do it. You are right that a complete rewrite was needed. /me goes off to install fish and test it. |
@alex7kom Honestly, if you can commit to keeping your fish port up to date such that it can be a seamless drop-in for standard Thoughts? |
I tried it, works nice, thanks! 👍 Just a thought, python virtualenv provides |
https://github.com/Alex7Kom/nvm-fish has worked great for me. Would love to see the main project support fish out of the box at some point. |
Sorry to dredge up an old issue, but with all the recent hype about io.js, and with the latest nvm now supporting installing io.js, this has become a bigger issue for fish users again. The latest version of the nvm-fish fork is woefully outdated compared to current nvm, and so therefore can't be used to install io.js. Has any more thought been put into this? |
There's a PR open to get it to work, but fish being wildly different than most shells, some of the changes required concern me. I'm still open to the possibility. |
I've written a wrapper that lets fish people use nvm seamlessly: https://github.com/passcod/nvm-fish-wrapper 🐟 It works by running nvm in bash within a fish function, and doing some magic to pass the (relevant parts of the) environment through and export it again once nvm returns. Doing so incurs a noticeable delay (about 1 second) before nvm is run, but I think that's acceptable. Because it's just a wrapper, it will always work (unlike the nvm-fish port), requiring no maintenance while nvm can be updated at will, unless nvm changes significantly. Additionally, it uses the same nvm as other shells, so nodes (and ios) are shared (again, unlike the nvm-fish port). And it's less than two pagefuls of code ;P It is similar in thought to #579 but less intrusive and requires no changes in nvm. |
Update README: Point fish users in the right direction (relates to #303)
I also wrote a general wrapper to bring almost any bash utility to fish shell: https://github.com/edc/bass. It works flawlessly with nvm using syntax like
and then just use |
@edc This is really cool! Does it work as well on linux and on OS X? If so I'll post a notice on nvm-fish-wrapper to use |
@passcod I only tested it on OS X. Should work on Linux. It probably does not work on Windows. |
Thanks to @edc for creating bass. Thanks to @lnikkila and @brandonweiss for code contributions. Thanks to @keithamus, @externl, @blazeworx, @taktran, @jkarttunen, @jakubholynet, @doughsay, @alex7kom, @msx, @steve-ross, @leebrooks0, @nanoxd, @tomekiwi, @randyschneck, @jadengore, as well as the contributors above for reporting bugs and helping out in the issue threads. Thanks also to all stargazers not mentioned above: @Globegitter, @luhmann, @oahziur, @mike-engel, @yamafaktory, @footearth, @pborenstein, @ceejbot (famous npm people starring my work! *o*), @plord, @sobering, @matthewspencer, @rossluebe, @d6u, @arnaudsj, @jney, @arbourd, @jeromecovington, @mhamann, @kompot, @cryptoquick, @sarkian, @blissdev, @Thimoteus, @eush77, @dd1994, @berkus, @judasnow, @paulriddle, @giodamelio, @ScottMaclure, @deepsweet, @Maxim-Tuvanov, @CarterTsai, @Lordnibbler, @ismay, @OtaK, @nicksergeant, @SeeThruHead, @halhenke, @jerray, @therocketforever, @colinmeinke, @MadMub, @barberousse, @karlbateman, @benmarten, @mistadikay, @AdamCanady, @bheesham, @jboulouloubi, @moretti, @adri, @RFS4ever, @hcevns, @zhongxingdou, @marceloboeira, @musically-ut, @fuzetsu, @makotot, @tomekwi, @jeffbcross (dear me, an Angular.js committer?! *o*), @olessavluk, @imposibrus, @AndreTheHunter, @volodymyrkoval, @denji, @nemoDreamer, @legatoo, @atesgoral, @ThomWright, @jcrben, @ZuraGuerra, @andyklimczak, @Nek, @a1ip, @alfredooo, @passerbyid, @dariuszdziuk (hello Spotify, listening with you right this moment), @lordzfc, @StepanKuzmin, @joshhunt, @daniel-shin1104, @michalmarczyk, and @knappg. Thanks to @creationix for creating NVM. Thanks to all those on the nvm-sh/nvm#303 thread. Thanks to @alxcenz for being a constant inspiration and a friend. Thanks to @makoConstruct for visions of a better future. Thanks to all of Merveilles for reasons. Thanks to Saf for being a bright star shining always. Thanks to Léa. Je t'aime. Thanks to my parents for letting me code until the wee hours of the morning. To Dad for giving me help with Logo. That turtle is the best thing that's happened to my programming. Thanks to all you awesome people, past present and future. …okay, that got long and involved and a bit over the top. It's been humbling to have all these people on a project. Have a good day, friends.
Adds information about bass to the README which is directly recommended by nvm-fish-wrapper and can support iojs (unlike nvm-fish), this is in relation to Issue nvm-sh#303.
Thanks to @edc for creating bass. Thanks to @lnikkila and @brandonweiss for code contributions. Thanks to @keithamus, @externl, @blazeworx, @taktran, @jkarttunen, @jakubholynet, @doughsay, @alex7kom, @msx, @steve-ross, @leebrooks0, @nanoxd, @tomekiwi, @randyschneck, @jadengore, as well as the contributors above for reporting bugs and helping out in the issue threads. Thanks also to all stargazers not mentioned above: @Globegitter, @luhmann, @oahziur, @mike-engel, @yamafaktory, @footearth, @pborenstein, @ceejbot (famous npm people starring my work! *o*), @plord, @sobering, @matthewspencer, @rossluebe, @d6u, @arnaudsj, @jney, @arbourd, @jeromecovington, @mhamann, @kompot, @cryptoquick, @sarkian, @blissdev, @Thimoteus, @eush77, @dd1994, @berkus, @judasnow, @paulriddle, @giodamelio, @ScottMaclure, @deepsweet, @Maxim-Tuvanov, @CarterTsai, @Lordnibbler, @ismay, @OtaK, @nicksergeant, @SeeThruHead, @halhenke, @jerray, @therocketforever, @colinmeinke, @MadMub, @barberousse, @karlbateman, @benmarten, @mistadikay, @AdamCanady, @bheesham, @jboulouloubi, @moretti, @adri, @RFS4ever, @hcevns, @zhongxingdou, @marceloboeira, @musically-ut, @fuzetsu, @makotot, @tomekwi, @jeffbcross (dear me, an Angular.js committer?! *o*), @olessavluk, @imposibrus, @AndreTheHunter, @volodymyrkoval, @denji, @nemoDreamer, @legatoo, @atesgoral, @ThomWright, @jcrben, @ZuraGuerra, @andyklimczak, @Nek, @a1ip, @alfredooo, @passerbyid, @dariuszdziuk (hello Spotify, listening with you right this moment), @lordzfc, @StepanKuzmin, @joshhunt, @daniel-shin1104, @michalmarczyk, and @knappg. Thanks to @creationix for creating NVM. Thanks to all those on the nvm-sh/nvm#303 thread. Thanks to @alxcenz for being a constant inspiration and a friend. Thanks to @makoConstruct for visions of a better future. Thanks to all of Merveilles for reasons. Thanks to Saf for being a bright star shining always. Thanks to Léa. Je t'aime. Thanks to my parents for letting me code until the wee hours of the morning. To Dad for giving me help with Logo. That turtle is the best thing that's happened to my programming. Thanks to all you awesome people, past present and future. …okay, that got long and involved and a bit over the top. It's been humbling to have all these people on a project. Have a good day, friends.
Thanks to @edc for creating bass. Thanks to @lnikkila and @brandonweiss for code contributions. Thanks to @keithamus, @externl, @blazeworx, @taktran, @jkarttunen, @jakubholynet, @doughsay, @alex7kom, @msx, @steve-ross, @leebrooks0, @nanoxd, @tomekiwi, @randyschneck, @jadengore, as well as the contributors above for reporting bugs and helping out in the issue threads. Thanks also to all stargazers not mentioned above: @Globegitter, @luhmann, @oahziur, @mike-engel, @yamafaktory, @footearth, @pborenstein, @ceejbot (famous npm people starring my work! *o*), @plord, @sobering, @matthewspencer, @rossluebe, @d6u, @arnaudsj, @jney, @arbourd, @jeromecovington, @mhamann, @kompot, @cryptoquick, @sarkian, @blissdev, @Thimoteus, @eush77, @dd1994, @berkus, @judasnow, @paulriddle, @giodamelio, @ScottMaclure, @deepsweet, @Maxim-Tuvanov, @CarterTsai, @Lordnibbler, @ismay, @OtaK, @nicksergeant, @SeeThruHead, @halhenke, @jerray, @therocketforever, @colinmeinke, @MadMub, @barberousse, @karlbateman, @benmarten, @mistadikay, @AdamCanady, @bheesham, @jboulouloubi, @moretti, @adri, @RFS4ever, @hcevns, @zhongxingdou, @marceloboeira, @musically-ut, @fuzetsu, @makotot, @tomekwi, @jeffbcross (dear me, an Angular.js committer?! *o*), @olessavluk, @imposibrus, @AndreTheHunter, @volodymyrkoval, @denji, @nemoDreamer, @legatoo, @atesgoral, @ThomWright, @jcrben, @ZuraGuerra, @andyklimczak, @Nek, @a1ip, @alfredooo, @passerbyid, @dariuszdziuk (hello Spotify, listening with you right this moment), @lordzfc, @StepanKuzmin, @joshhunt, @daniel-shin1104, @michalmarczyk, and @knappg. Thanks to @creationix for creating NVM. Thanks to all those on the nvm-sh/nvm#303 thread. Thanks to @alxcenz for being a constant inspiration and a friend. Thanks to @makoConstruct for visions of a better future. Thanks to all of Merveilles for reasons. Thanks to Saf for being a bright star shining always. Thanks to Léa. Je t'aime. Thanks to my parents for letting me code until the wee hours of the morning. To Dad for giving me help with Logo. That turtle is the best thing that's happened to my programming. Thanks to all you awesome people, past present and future. …okay, that got long and involved and a bit over the top. It's been humbling to have all these people on a project. Have a good day, friends.
If you use Oh My Fish framework you can use foreign-env to run |
Thanks to @edc for creating bass. Thanks to @lnikkila and @brandonweiss for code contributions. Thanks to @keithamus, @externl, @blazeworx, @taktran, @jkarttunen, @jakubholynet, @doughsay, @alex7kom, @msx, @steve-ross, @leebrooks0, @nanoxd, @tomekiwi, @randyschneck, @jadengore, as well as the contributors above for reporting bugs and helping out in the issue threads. Thanks also to all stargazers not mentioned above: @Globegitter, @luhmann, @oahziur, @mike-engel, @yamafaktory, @footearth, @pborenstein, @ceejbot (famous npm people starring my work! *o*), @plord, @sobering, @matthewspencer, @rossluebe, @d6u, @arnaudsj, @jney, @arbourd, @jeromecovington, @mhamann, @kompot, @cryptoquick, @sarkian, @blissdev, @Thimoteus, @eush77, @dd1994, @berkus, @judasnow, @paulriddle, @giodamelio, @ScottMaclure, @deepsweet, @Maxim-Tuvanov, @CarterTsai, @Lordnibbler, @ismay, @OtaK, @nicksergeant, @SeeThruHead, @halhenke, @jerray, @therocketforever, @colinmeinke, @MadMub, @barberousse, @karlbateman, @benmarten, @mistadikay, @AdamCanady, @bheesham, @jboulouloubi, @moretti, @adri, @RFS4ever, @hcevns, @zhongxingdou, @marceloboeira, @musically-ut, @fuzetsu, @makotot, @tomekwi, @jeffbcross (dear me, an Angular.js committer?! *o*), @olessavluk, @imposibrus, @AndreTheHunter, @volodymyrkoval, @denji, @nemoDreamer, @legatoo, @atesgoral, @ThomWright, @jcrben, @ZuraGuerra, @andyklimczak, @Nek, @a1ip, @alfredooo, @passerbyid, @dariuszdziuk (hello Spotify, listening with you right this moment), @lordzfc, @StepanKuzmin, @joshhunt, @daniel-shin1104, @michalmarczyk, and @knappg. Thanks to @creationix for creating NVM. Thanks to all those on the nvm-sh/nvm#303 thread. Thanks to @alxcenz for being a constant inspiration and a friend. Thanks to @makoConstruct for visions of a better future. Thanks to all of Merveilles for reasons. Thanks to Saf for being a bright star shining always. Thanks to Léa. Je t'aime. Thanks to my parents for letting me code until the wee hours of the morning. To Dad for giving me help with Logo. That turtle is the best thing that's happened to my programming. Thanks to all you awesome people, past present and future. …okay, that got long and involved and a bit over the top. It's been humbling to have all these people on a project. Have a good day, friends.
@derekstavis That's a great tip, thanks. With bass I have some troubles, but with fish functions + foreign-env it works!:
|
@estebanprimost Now we have a dedicated nvm package. Just |
Man, again? I thought they resolved this. The omf project seems to be plagued with copyright problems. |
We also thought this was solved, but then we got striked again by dirty competition. Github should be freeing our repository in next few days, as the requester gave up on fighting.
In fact we (omf project) never infringed copyright. But it's how DMCA requests work. You don't need to prove anything and Github takes down your repo to keep safe harbour protection. |
Yes, apologies. I really meant to say "DMCA requests" but left it as is because I didn't remember what had happened and left to research it. Then I got bored of reading about douchenozzles, but let's not hijack this thread further. Outside people looking to use omf: find someone who already has an install and ask them for a tarball or git clone or something. Git is distributed, yay. |
Sorry if I sounded gross @passcod, I was affected by such a hard time in Oh My Fish. But well.. Now we are back!! |
Fish shell noob here. while |
Hey @shangsunset, install |
@derekjkeller yea. i was using fisherman at first. ended up switching to oh-my-fish and your |
Awesome @shangsunset, I hope you like the plugin. Feel free to file a bug if you find any issue 👍 |
Someone reading this thread in the future will be seriously misdirected, so let me fix that. The reason @shangsunset was having trouble with nvm has nothing to do with fisherman or omf, but incorrect got bass?In fish, there are a few ways to run nvm, IMO the best way to go about this is using You don't even need fisherman / omf to do any of this. how??Create a dummy function nvm
bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv
end Run this function at the start of your shell session _every time_ (or when you cd into a directory with a okay, but i don't want to run
|
Minor correction: a While it is good that you got it working, knowing what goes on under the hood is also essential in debugging problems you might face in the future. |
@shangsunset wrong derek referenced in your comment earlier, but he obviously saw it. |
I just use #!/bin/bash
export NVM_SYMLINK_CURRENT=true
if [[ -s $HOME/.nvm/nvm.sh ]] ;
then
source $HOME/.nvm/nvm.sh;
else
echo "No nvm found in `$HOME/.nvm/nvm.sh`";
fi
nvm $@ And then add |
NVM has an example of a change directory hook to automatically call If you want the same in Fish, use this adopted function: |
With this package installed, nvm works fine: |
|
@elovin that wouldn’t leave nvm available inside fish to change the node version, which is the primary use case of nvm. |
@ljharb hm I'm not sure if I do something different in the setup then because I can switch between node versions just fine Update: |
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
This comment was marked as spam.
Thanks @Globegitter has worked me too : |
I have written a fish function which basically executes nvm in a bash login shell and sets the path accordingly: |
Add the following to the fish config and restart the terminal (or reload the config): function nvm
bash -c "source ~/.nvm/nvm.sh; nvm $argv"
end |
How do I install NVM for the fish shell?
The text was updated successfully, but these errors were encountered: