Giter Site home page Giter Site logo

plugin-nvm's Introduction

plugin-nvm

A nvm wrapper for Oh My Fish.

MIT License Fish Shell Version Oh My Fish Framework Travis Status


Install

$ omf install nvm

NB You have to install nvm itself separately (the curl method works fine under Fish too).

Usage

$ nvm --help

If you have a custom $NVM_DIR, please add the following line to your ~/.config/fish/config.fish, replacing the path accordingly:

set -gx NVM_DIR /path/to/nvm

Refresh your shell and you are good to go!

refresh

License

MIT © Derek Willian Stavis et al

plugin-nvm's People

Contributors

ameuret avatar derekstavis avatar lunij avatar tomsaleeba avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

plugin-nvm's Issues

No default links created

For some reason the plugin stopped working yesterday. I am using fish & omf. Tried reinstalling, but same issue.

After installation node/npm is not recognized as command. I can manually fix it by creating symlinks:
ln -s /Users/Ben/.nvm/versions/node/v5.7.1/bin/npm /usr/local/bin/npm

but after that I run into permission issues... any idea whats changed or wrong?

Does not pickup default node version

I am using your wrapper - thanks for making it.

Only problem I have is that my fish shell keeps forgetting the default node version that I have set via:
nvm alias default 0.12

⋊> ~ node -v                                                                                                            16:59:06
fish: Unknown command 'node'
⋊> ~ bash                                                                                                               16:59:08
bash-3.2$ node -v
v0.12.7
bash-3.2$ exit
⋊> ~ nvm alias default 0.12                                                                                             16:59:22
default -> 0.12 (-> v0.12.7)
⋊> ~ node -v                                                                                                            16:59:28
v0.12.7

It is working in bash... any ideas?

"refresh" function deprecated

In the README, after running omf install nvm, the final step is to run refresh. However, FISH version 2.7.1 complains:

warning: function refresh is deprecated and will be removed soon.

What is the alternative to refresh?

NVM not using default version

Thanks in advance! Here's my issue: When using oh-my-fish and this nvm plugin, I can set 'default' to be the version of node I want. However, nvm is defaulting to 'system' instead of 'default'. I can switch which version of node I'm using, but whenever I start up a new terminal nvm reverts back to 'system'. I've also tried creating an alias for system, but that didn't work. How can I get nvm to remember what my default is? Attached is a screenshot to illustrate my problem.

omf-nvm-default

init.fish (line 10): Expected a string, but instead found a '&'

After the most recent fish shell update on Ubuntu, fish loses the ability to find node / nvm. I get the following message on opening terminal.

~/.local/share/omf/pkg/nvm/init.fish (line 10): Expected a string, but instead found a '&'
    fenv source $nvm_prefix/nvm.sh >/dev/null ^&1
                                               ^
from sourcing file ~/.local/share/omf/pkg/nvm/init.fish
        called during startup
in function 'require' with arguments '--path /home/navi/.local/share/omf/pkg/await /home/navi/.local/share/omf/pkg/aws /home/navi/.local/share/omf/pkg/config /home/navi/.local/share/omf/pkg/fish-spec /home/navi/.local/share/omf/pkg/foreign-env /home/navi/.local/share/omf/pkg/nvm /home/navi/.local/share/omf/pkg/omf /home/navi/.local/share/omf/pkg/pisces /home/navi/.local/share/omf/pkg/spark /home/navi/.local/share/omf/pkg/tmux-zen /home/navi/.local/share/omf/pkg/weather'
        called on line 24 of file ~/.local/share/omf/init.fish
from sourcing file ~/.local/share/omf/init.fish
        called on line 7 of file ~/.config/fish/conf.d/omf.fish
from sourcing file ~/.config/fish/conf.d/omf.fish
        called on line 294 of file /usr/share/fish/config.fish
from sourcing file /usr/share/fish/config.fish
        called during startup
source: Error while reading file “/home/navi/.local/share/omf/pkg/nvm/init.fish”

Default alias is ignored

This is the original issue, that was closed without being addressed (original reporter used a workaround).
#23

Setting a default alias for a version is still ignored - the new terminal always defaults to the system version

Question about lazy loading and `init_nvm` event

I am a new fish user and first off thanks for the plugin!

I've been trying to find a way to lazy load on a new shell, but I can't seem to find where or how the event init_nvm is emitted in the function in init.sh.

I think I found a work-around where I can lazy load nvm in fish. What do you think?

  • I changed the event in init.fish to load_nvm (this seemed to prevent it from running on new shell startup)
  • I added emit load_nvm to functions/nvm.sh
  • Now every time you run nvm $arg it will load it on demand
  • Is there any problem with this approach?
function init -a path --on-event load_nvm
  if type -q fenv
    set -q NVM_DIR; or set -gx NVM_DIR ~/.nvm
    set -g nvm_prefix $NVM_DIR

    type -q brew;
      and test -e (brew --prefix)/Cellar/nvm;
        and set -g nvm_prefix (brew --prefix nvm)

    fenv source $nvm_prefix/nvm.sh >/dev/null ^&1
  end

end
function nvm -d "Node version manager"
  emit load_nvm
  if test -e $nvm_prefix/nvm.sh
    if not type -q fenv
      echo "You need to install foreign-env plugin"
      return 1
    end

    fenv source $nvm_prefix/nvm.sh --no-use ';' nvm $argv
  else
    echo "You need to install nvm itself (see https://github.com/creationix/nvm#installation)"
    return 1
  end
end

Brew install prefix issue

After installing nvm via brew and then adding the nvm plugin, when I try eg:

⋊> /V/M/p/aurelia nvm use current                                                                                                                                            

I get

nvm is not compatible with the npm config "prefix" option: currently set to "/usr/local/Cellar/nvm/0.29.0/versions/node/v5.1.0"
Run `npm config delete prefix` or `nvm use --delete-prefix v5.1.0` to unset it.

Using the --delete-prefix does work, but I always need to use it or it fails. Any ideas how to fix it? Is there a better way to install nvm?

`env: illegal option -- 0` trailing every message

I recently installed this plugin to manage my nvm install. I've confirmed it works in bash, but as soon as I use fish, I see all messages are followed by:

env: illegal option -- 0
usage: env [-iv] [-P utilpath] [-S string] [-u name]
           [name=value ...] [utility [argument ...]]

Full output:

 ~  nvm -h                                     930ms  Wed Jul 19 15:09:32 2023

Node Version Manager (v0.39.3)

Note: <version> refers to any version-like string nvm understands. This includes:
  - full or partial version numbers, starting with an optional "v" (0.10, v0.1.2, v1)
  - default (built-in) aliases: node, stable, unstable, iojs, system
  - custom aliases you define with `nvm alias foo`

 Any options that produce colorized output should respect the `--no-colors` option.

Usage:
  nvm --help                                  Show this message
    --no-colors                               Suppress colored output
  nvm --version                               Print out the installed version of nvm
  nvm install [<version>]                     Download and install a <version>. Uses .nvmrc if available and version is omitted.
   The following optional arguments, if provided, must appear directly after `nvm install`:
    -s                                        Skip binary download, install from source only.
    -b                                        Skip source download, install from binary only.
    --reinstall-packages-from=<version>       When installing, reinstall packages installed in <node|iojs|node version number>
    --lts                                     When installing, only select from LTS (long-term support) versions
    --lts=<LTS name>                          When installing, only select from versions for a specific LTS line
    --skip-default-packages                   When installing, skip the default-packages file if it exists
    --latest-npm                              After installing, attempt to upgrade to the latest working npm on the given node version
    --no-progress                             Disable the progress bar on any downloads
    --alias=<name>                            After installing, set the alias specified to the version specified. (same as: nvm alias <name> <version>)
    --default                                 After installing, set default alias to the version specified. (same as: nvm alias default <version>)
  nvm uninstall <version>                     Uninstall a version
  nvm uninstall --lts                         Uninstall using automatic LTS (long-term support) alias `lts/*`, if available.
  nvm uninstall --lts=<LTS name>              Uninstall using automatic alias for provided LTS line, if available.
  nvm use [<version>]                         Modify PATH to use <version>. Uses .nvmrc if available and version is omitted.
   The following optional arguments, if provided, must appear directly after `nvm use`:
    --silent                                  Silences stdout/stderr output
    --lts                                     Uses automatic LTS (long-term support) alias `lts/*`, if available.
    --lts=<LTS name>                          Uses automatic alias for provided LTS line, if available.
  nvm exec [<version>] [<command>]            Run <command> on <version>. Uses .nvmrc if available and version is omitted.
   The following optional arguments, if provided, must appear directly after `nvm exec`:
    --silent                                  Silences stdout/stderr output
    --lts                                     Uses automatic LTS (long-term support) alias `lts/*`, if available.
    --lts=<LTS name>                          Uses automatic alias for provided LTS line, if available.
  nvm run [<version>] [<args>]                Run `node` on <version> with <args> as arguments. Uses .nvmrc if available and version is omitted.
   The following optional arguments, if provided, must appear directly after `nvm run`:
    --silent                                  Silences stdout/stderr output
    --lts                                     Uses automatic LTS (long-term support) alias `lts/*`, if available.
    --lts=<LTS name>                          Uses automatic alias for provided LTS line, if available.
  nvm current                                 Display currently activated version of Node
  nvm ls [<version>]                          List installed versions, matching a given <version> if provided
    --no-colors                               Suppress colored output
    --no-alias                                Suppress `nvm alias` output
  nvm ls-remote [<version>]                   List remote versions available for install, matching a given <version> if provided
    --lts                                     When listing, only show LTS (long-term support) versions
    --lts=<LTS name>                          When listing, only show versions for a specific LTS line
    --no-colors                               Suppress colored output
  nvm version <version>                       Resolve the given description to a single local version
  nvm version-remote <version>                Resolve the given description to a single remote version
    --lts                                     When listing, only select from LTS (long-term support) versions
    --lts=<LTS name>                          When listing, only select from versions for a specific LTS line
  nvm deactivate                              Undo effects of `nvm` on current shell
    --silent                                  Silences stdout/stderr output
  nvm alias [<pattern>]                       Show all aliases beginning with <pattern>
    --no-colors                               Suppress colored output
  nvm alias <name> <version>                  Set an alias named <name> pointing to <version>
  nvm unalias <name>                          Deletes the alias named <name>
  nvm install-latest-npm                      Attempt to upgrade to the latest working `npm` on the current node version
  nvm reinstall-packages <version>            Reinstall global `npm` packages contained in <version> to current version
  nvm unload                                  Unload `nvm` from shell
  nvm which [current | <version>]             Display path to installed node version. Uses .nvmrc if available and version is omitted.
    --silent                                  Silences stdout/stderr output when a version is omitted
  nvm cache dir                               Display path to the cache directory for nvm
  nvm cache clear                             Empty cache directory for nvm
  nvm set-colors [<color codes>]              Set five text colors using format "yMeBg". Available when supported.
                                               Initial colors are:
                                                  bygre
                                               Color codes:
                                                r/R = red / bold red
                                                g/G = green / bold green
                                                b/B = blue / bold blue
                                                c/C = cyan / bold cyan
                                                m/M = magenta / bold magenta
                                                y/Y = yellow / bold yellow
                                                k/K = black / bold black
                                                e/W = light grey / white
Example:
  nvm install 8.0.0                     Install a specific version number
  nvm use 8.0                           Use the latest available 8.0.x release
  nvm run 6.10.3 app.js                 Run app.js using node 6.10.3
  nvm exec 4.8.3 node app.js            Run `node app.js` with the PATH pointing to node 4.8.3
  nvm alias default 8.1.0               Set default node version on a shell
  nvm alias default node                Always default to the latest available node version on a shell

  nvm install node                      Install the latest available version
  nvm use node                          Use the latest version
  nvm install --lts                     Install the latest LTS version
  nvm use --lts                         Use the latest LTS version

  nvm set-colors cgYmW                  Set text colors to cyan, green, bold yellow, magenta, and white

Note:
  to remove, delete, or uninstall nvm - just remove the `$NVM_DIR` folder (usually `~/.nvm`)

env: illegal option -- 0
usage: env [-iv] [-P utilpath] [-S string] [-u name]
           [name=value ...] [utility [argument ...]]

I'm assuming it's an issue on my end since this laptop is a bit old... Any ideas what would be causing this message?

You need to install nvm itself shows after refresh

On ubuntu 20.04
Fish version 3.1

Steps to reproduce

  • install nvm with omf install nvm
  • run nvm all works good
  • refresh
  • try to run nvm you get an error You need to install nvm itself (see https://github.com/creationix/nvm#installation)

Node not available on a new terminal

Whenever I open a new tab or a completely new terminal I always have to do

$ nvm use x.y.z

or else I will get:

The program 'npm' is currently not installed. You can install it by typing:
sudo apt-get install npm

I have just run omf update just to make sure that I had everything updated.

Defer initialising nvm until first use

Starting fish with this plugin is quite slow. Without nvm 0:00.03elapsed, with nvm 0:00.55elapsed.

I have a noticeable delay when staring my program launcher. Would be really great if it was possible to load nvm on first use, instead of when this plugin is loaded.

$ omf remove nvm
nvm successfully removed.

$ time fish -c exit
0.02user 0.00system 0:00.03elapsed 100%CPU (0avgtext+0avgdata 5880maxresident)k
0inputs+0outputs (0major+1064minor)pagefaults 0swap

$ omf install nvm
Updating https://github.com/oh-my-fish/packages-main master... Done!
Installing package nvm
✔ nvm successfully installed

$ time fish -c exit
0.51user 0.08system 0:00.55elapsed 107%CPU (0avgtext+0avgdata 36024maxresident)k
0inputs+8outputs (0major+32142minor)pagefaults 0swaps

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.