All Projects → FabioAntunes → Fish Nvm

FabioAntunes / Fish Nvm

Licence: mit
nvm wrapper for fish-shell

Programming Languages

shell
77523 projects

Projects that are alternatives of or similar to Fish Nvm

Atom Autocomplete Module Import
⚛️ Search & install npm packages from import/require statements.
Stars: ✭ 182 (-45.83%)
Mutual labels:  npm, yarn
Nvm.fish
Node.js version manager lovingly made for Fish.
Stars: ✭ 881 (+162.2%)
Mutual labels:  fish, nvm
Cheat Sheets
Cheat Sheets 🐭🤖👀
Stars: ✭ 185 (-44.94%)
Mutual labels:  npm, yarn
Yarnhook
Run `yarn install`, `npm install` or `pnpm install` on git hooks automatically
Stars: ✭ 177 (-47.32%)
Mutual labels:  npm, yarn
Ngx Smart Modal
Modal/Dialog component crafted for Angular
Stars: ✭ 256 (-23.81%)
Mutual labels:  npm, yarn
Ni
💡 Use the right package manager
Stars: ✭ 179 (-46.73%)
Mutual labels:  npm, yarn
Yalc
Work with yarn/npm packages locally like a boss.
Stars: ✭ 3,155 (+838.99%)
Mutual labels:  npm, yarn
Pinst
🍺 dev only postinstall hooks (package.json)
Stars: ✭ 162 (-51.79%)
Mutual labels:  npm, yarn
setup-linux-debian
Installs essential JavaScript development programs.
Stars: ✭ 16 (-95.24%)
Mutual labels:  yarn, nvm
awesome-env-config-cn
各种开发语言项目环境国内(中国国内加速镜像)配置教程和部分实践经验,包括github.com, nodejs,npm,nvm, yarn, java, maven, gradle, python, mysys2, elasticsearch, php,golang等等,更多正在加入中...
Stars: ✭ 50 (-85.12%)
Mutual labels:  yarn, nvm
Script Progress
Estimate script execution time
Stars: ✭ 175 (-47.92%)
Mutual labels:  npm, yarn
Yvm
🧶 Manage multiple versions of Yarn
Stars: ✭ 265 (-21.13%)
Mutual labels:  npm, yarn
Bolt
⚡️ Super-powered JavaScript project management
Stars: ✭ 2,134 (+535.12%)
Mutual labels:  npm, yarn
Greenkeeper Lockfile
🔒 Your lockfile, up to date, all the time
Stars: ✭ 181 (-46.13%)
Mutual labels:  npm, yarn
React D3 Speedometer
✨ ⚛️ React Speedometer component using d3.js 🌈 🎨
Stars: ✭ 162 (-51.79%)
Mutual labels:  npm, yarn
Corepack
Zero-runtime-dependency package acting as bridge between Node projects and their package managers
Stars: ✭ 196 (-41.67%)
Mutual labels:  npm, yarn
Sass Recipes
Sass things that I do all the time or should remember to do because googling tutorials gets old
Stars: ✭ 156 (-53.57%)
Mutual labels:  npm, yarn
Defu
Assign default properties, recursively. 🌊
Stars: ✭ 161 (-52.08%)
Mutual labels:  npm, yarn
Plugin Nvm
Node version manager wrapper for Fish shell
Stars: ✭ 173 (-48.51%)
Mutual labels:  fish, nvm
Install nodejs and yarn homebrew
The guide for installing nvm | node | yarn via homebrew
Stars: ✭ 261 (-22.32%)
Mutual labels:  yarn, nvm

fish-nvm

NVM wrapper for fish-shell.

Install

Make sure you have NVM installed first.

With Fisher

fisher install FabioAntunes/fish-nvm edc/bass

With oh-my-fish

omf install https://github.com/fabioantunes/fish-nvm
omf install https://github.com/edc/bass

With fundle

fundle plugin 'FabioAntunes/fish-nvm'
fundle plugin 'edc/bass'
fundle install

Add these lines to ~/.config/fish/config.fish

fundle plugin 'FabioAntunes/fish-nvm'
fundle plugin 'edc/bass'
fundle init

fish-nvm depends on bass

Usage

nvm install 6.11.1
nvm alias default 6.11.1

How it works

The way this plugin works is delaying sourcing NVM, until we really need it. That way we don't have those annoying 1/2 seconds of delay every time we open a new terminal window/tab.

By delaying the sourcing of NVM YOUR NODE BINARIES WON'T BE LOADED until you source NVM or run one of the following aliases. If you want to source NVM every single time you open a terminal just use bass

fish nvm example

There are a couple of aliases already created. These will source NVM whenever you call them:

  • npm
  • yarn
  • node
  • nvm
  • npx

What this means is that if you depend on other node global packages, let's say gulp, if you try to run gulp in a new window/tab you will get something like Command unknown. One way to solve this is running nvm use default, or any of the aliases before using the command gulp. If you primarily depend on these global packages, that's far from great.

One possible way is for you to manually create your function inside ~/.config/fish/functions, so for gulp would be something like this:

function gulp -d "gulp task manager" -w gulp
  __nvm_run "gulp" $argv
end

To simplify this process there's an helper function on fish-nvm just run nvm_alias_function name, you can pass multiple packages names, separated by spaces:

nvm_alias_function gulp webpack grunt

fish nvm example

This will create 3 functions on your functions folder ~/.config/fish/functions

Another common scenario is if you need to have the binary of the node or package available. For example, if you are a vim user, some plugins need access to the node binary. Since we only source NVM when we use one of the aliases, you will probably get an error saying that node isn't available

Again one possible way is for you to manually create an alias binary for node in the folder /usr/local/bin

touch /usr/local/bin/node

Open that file on your editor and paste the following:

#! /usr/bin/env fish

__nvm_run "node" $argv

Make that file executable:

chmod +x /usr/local/bin/node

Test it

which node

To simplify this process there's another helper function nvm_alias_command

If you run nvm_alias_command without any arguments it will create the following aliases binaries by default:

  • npm
  • node
  • npx
  • yarn

fish nvm example

To create additional aliases, you can pass them as arguments separated by spaces

nvm_alias_command eslint prettier

The default output path is /urs/local/bin, if you get an error message due to permissions, try running with sudo permissions:

sudo fish nvm_alias_command eslint prettier

To change the default output folder, you can set a global variable:

set -g nvm_alias_output /other/path

Please read these Notes:

Sometimes it might happen NVM is already sourced, with the wrong version, or not respecting your default version. Check your ~/.profile or ~/.bashrc or ~/.bash_profile. If that's the case, remove the line that sources NVM.

Make sure you set a default node version or create a .nvmrc file on your working directory. fish-nvm will try to use the .nvmrc version specified, if the file exists, if there's no file it will try to use the default version.

If you don't use the .nvmrc file or if you don't set a default version, you will have to run nvm use node-version every time you open a new terminal and want to use node or npm

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

Also, if you have a custom installation path but still set $NVM_DIR to default path. For example this could happen if you install NVM using brew, which would install NVM into: /usr/local/Cellar/nvm/%nvm_version%/nvm.sh

If that is the case, you need to add the following line to your ~/.config/fish/config.fish, replacing the path accordingly:

set -gx nvm_prefix /path/to/nvm

NOTE:

DO NOT use a trailing slash in NVM_DIR variable. Adding it will cause error: nvm is not compatible with the npm config "prefix" option

License

fish-nvm is MIT licensed.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].