{"id":13479192,"url":"https://github.com/lukechilds/zsh-nvm","last_synced_at":"2025-04-11T11:49:37.168Z","repository":{"id":38338847,"uuid":"62844767","full_name":"lukechilds/zsh-nvm","owner":"lukechilds","description":"Zsh plugin for installing, updating and loading nvm","archived":false,"fork":false,"pushed_at":"2024-07-03T04:34:11.000Z","size":86,"stargazers_count":2297,"open_issues_count":30,"forks_count":117,"subscribers_count":22,"default_branch":"master","last_synced_at":"2025-04-03T15:07:25.016Z","etag":null,"topics":["antigen","nvm","oh-my-zsh","version-manager","zgen","zim","zplug","zsh","zsh-nvm","zsh-plugin","zsh-plugins"],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lukechilds.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["lukechilds"],"custom":["https://blockstream.info/address/1LukeQU5jwebXbMLDVydeH4vFSobRV9rkj","https://blockstream.info/address/3Luke2qRn5iLj4NiFrvLBu2jaEj7JeMR6w","https://blockstream.info/address/bc1qlukeyq0c69v97uss68fet26kjkcsrymd2kv6d4","https://tippin.me/@lukechilds"]}},"created_at":"2016-07-07T23:40:21.000Z","updated_at":"2025-04-01T13:01:32.000Z","dependencies_parsed_at":"2024-10-18T08:34:46.032Z","dependency_job_id":null,"html_url":"https://github.com/lukechilds/zsh-nvm","commit_stats":{"total_commits":138,"total_committers":12,"mean_commits":11.5,"dds":0.07971014492753625,"last_synced_commit":"745291dcf20686ec421935f1c3f8f3a2918dd106"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukechilds%2Fzsh-nvm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukechilds%2Fzsh-nvm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukechilds%2Fzsh-nvm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lukechilds%2Fzsh-nvm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lukechilds","download_url":"https://codeload.github.com/lukechilds/zsh-nvm/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248389297,"owners_count":21095557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["antigen","nvm","oh-my-zsh","version-manager","zgen","zim","zplug","zsh","zsh-nvm","zsh-plugin","zsh-plugins"],"created_at":"2024-07-31T16:02:11.184Z","updated_at":"2025-04-11T11:49:37.150Z","avatar_url":"https://github.com/lukechilds.png","language":"Shell","funding_links":["https://github.com/sponsors/lukechilds","https://blockstream.info/address/1LukeQU5jwebXbMLDVydeH4vFSobRV9rkj","https://blockstream.info/address/3Luke2qRn5iLj4NiFrvLBu2jaEj7JeMR6w","https://blockstream.info/address/bc1qlukeyq0c69v97uss68fet26kjkcsrymd2kv6d4","https://tippin.me/@lukechilds"],"categories":["Shell","Plugins","Integration"],"sub_categories":["ZSH on Windows","Zinit (née zplugin)","Integrating with zsh"],"readme":"# zsh-nvm [![Build Status](https://travis-ci.org/lukechilds/zsh-nvm.svg?branch=master)](https://travis-ci.org/lukechilds/zsh-nvm)\n\n\u003e Zsh plugin for installing, updating and loading `nvm`\n\n[![GitHub Donate](https://badgen.net/badge/GitHub/Sponsor/D959A7?icon=github)](https://github.com/sponsors/lukechilds)\n[![Bitcoin Donate](https://badgen.net/badge/Bitcoin/Donate/F19537?icon=bitcoin)](https://lu.ke/tip/bitcoin)\n[![Lightning Donate](https://badgen.net/badge/Lightning/Donate/F6BC41?icon=bitcoin-lightning)](https://lu.ke/tip/lightning)\n\n[`nvm`](https://github.com/nvm-sh/nvm) is an awesome tool but it can be kind of a pain to install and keep up to date. This zsh plugin allows you to quickly setup `nvm` once, save it in your dotfiles, then never worry about it again.\n\nThe plugin will install the latest stable release of `nvm` if you don't already have it, and then automatically `source` it for you. You can upgrade `nvm` to the latest version whenever you want without losing your installed `node` versions by running `nvm upgrade`.\n\nAlthough this is written as a zsh plugin, it also works with bash if you follow the [manual installation instructions](#manually).\n\n## Usage\n\nOnce the plugin's installed `nvm` will be available. You'll probably want to load this as one of your first plugins so `node`/`npm` is available for any other plugins that may require them.\n\n`zsh-nvm` also wraps `nvm` in some additional functionality.\n\n### Upgrade\n\nIf you want to upgrade to the latest release of `nvm`:\n\n```shell\n% nvm upgrade\nInstalled version is v0.31.0\nChecking latest version of nvm...\nUpdating to v0.31.3...\nPrevious HEAD position was 2176894... v0.31.0\nHEAD is now at 56417f8... v0.31.3\n```\n\n### Revert\n\nIf an upgrade breaks something don't worry, reverting back to the previously installed version is simple:\n\n```shell\n% nvm revert\nInstalled version is v0.31.3\nReverting to v0.31.0...\nPrevious HEAD position was 56417f8... v0.31.3\nHEAD is now at 2176894... v0.31.0\n```\n\n### Install\n\nYou can install the latest Node.js nightlies or release candidates with `nvm install nightly|rc`. Aliases will automatically be created so you can easily `nvm use nightly|rc` in the future:\n\n```\n% nvm install rc\nDownloading and installing node v8.0.0-rc.1...\nDownloading https://nodejs.org/download/rc//v8.0.0-rc.1/node-v8.0.0-rc.1-darwin-x64.tar.xz...\n######################################################################## 100.0%\nComputing checksum with shasum -a 256\nChecksums matched!\nNow using node v8.0.0-rc.1 (npm v5.0.0-beta.56)\nrc -\u003e v8.0.0-rc.1\nClearing mirror cache...\nDone!\n```\n\n\u003e **Note:** This is a bit of a hack and leaving rc|nightly versions installed may break nvm when it eventually supports them itself. It's recommended that you don't leave the these versions of Node.js installed. Install them, test/play with them and then uninstall them when you're done.\n\n## Options\n\n### Custom Directory\n\nYou can specify a custom directory to use with `nvm` by exporting the `NVM_DIR` environment variable. It must be set before `zsh-nvm` is loaded.\n\nFor example, if you are using antigen, you would put the following in your `.zshrc`:\n\n```shell\nexport NVM_DIR=\"$HOME/.custom-nvm-dir\"\nantigen bundle lukechilds/zsh-nvm\n```\n\nNote: If `nvm` doesn't exist in this directory it'll be automatically installed when you start a session.\n\n### Nvm Completion\n\n`nvm` comes with a default bash_completion profile. If you want to enable it, you can do it by exporting  the `NVM_COMPLETION` environment variable and setting it to `true`. It must be set before `zsh-nvm` is loaded.\n\nFor example, if you are using antigen, you would put the following in your `.zshrc`:\n\n```bash\n# Export nvm completion settings for zsh-nvm plugin\nexport NVM_COMPLETION=true\nantigen bundle lukechilds/zsh-nvm\n```\n\n### Lazy Loading\n\nIf you find `nvm` adds too much lag to your shell startup you can enable lazy loading by exporting the `NVM_LAZY_LOAD` environment variable and setting it to `true`. It must be set before `zsh-nvm` is loaded.\n\nLazy loading is around 70x faster (874ms down to 12ms for me), however the first time you run `nvm`, `npm`, `node` or a global module you'll get a slight delay while `nvm` loads first. You'll only get this delay once per session.\n\nFor example, if you are using antigen, you would put the following in your `.zshrc`:\n\n```shell\nexport NVM_LAZY_LOAD=true\nantigen bundle lukechilds/zsh-nvm\n```\n\nPerformance comparison:\n\n```shell\n% time (source \"$NVM_DIR/nvm.sh\")\n( source \"$NVM_DIR/nvm.sh\"; )  0.58s user 0.37s system 109% cpu 0.874 total\n\n% time (_zsh_nvm_lazy_load)\n( _zsh_nvm_lazy_load; )  0.01s user 0.01s system 168% cpu 0.012 total\n```\n\n#### Extra commands to trigger lazy loading\nBy default lazy loading nvm is triggered by running the `nvm`, `node`, `npm` commands or any installed npm global binaries.\nIf you want to trigger the lazy loading via extra arbitrary commands you can define `NVM_LAZY_LOAD_EXTRA_COMMANDS` and set it to an array of commands as strings.\nThis can be usefull if programs are not in the above list of binaries but do depend on the availability of `node`, e.g. a vim plugin.\n\n```shell\nexport NVM_LAZY_LOAD_EXTRA_COMMANDS=('vim')\nvim --version\n#node is now loaded\n```\n\n### Don't autoload node\n\nBy default when `nvm` is loaded it'll automatically run `nvm use default` and load your default `node` version along with `npm` and any global modules. You can disable this behaviour by exporting the `NVM_NO_USE` environment variable and setting it to `true`. It must be set before `zsh-nvm` is loaded.\n\nIf you enable this option you will then need to manually run `nvm use \u003cversion\u003e` before you can use `node`.\n\nFor example, if you are using antigen, you would put the following in your `.zshrc`:\n\n```shell\nexport NVM_NO_USE=true\nantigen bundle lukechilds/zsh-nvm\n```\n\n### Auto use\n\nIf you have lots of projects with an `.nvmrc` file you may find the auto use option helpful. If it's enabled, when you `cd` into a directory with an `.nvmrc` file, `zsh-nvm` will automatically load or install the required node version in `.nvmrc`. You can enable it by exporting the `NVM_AUTO_USE` environment variable and setting it to `true`. It must be set before `zsh-nvm` is loaded.\n\nIf you enable this option and don't have `nvm` loaded in the current session (`NVM_LAZY_LOAD` or `NVM_NO_USE`) it won't work until you've loaded `nvm`.\n\nFor example, if you are using antigen, you would put the following in your `.zshrc`:\n\n```shell\nexport NVM_AUTO_USE=true\nantigen bundle lukechilds/zsh-nvm\n```\n\n## Installation\n\n### Using [Antigen](https://github.com/zsh-users/antigen)\n\nBundle `zsh-nvm` in your `.zshrc`\n\n```shell\nantigen bundle lukechilds/zsh-nvm\n```\n\n### Using [zplug](https://github.com/b4b4r07/zplug)\nLoad `zsh-nvm` as a plugin in your `.zshrc`\n\n```shell\nzplug \"lukechilds/zsh-nvm\"\n\n```\n### Using [zgen](https://github.com/tarjoilija/zgen)\n\nInclude the load command in your `.zshrc`\n\n```shell\nzgen load lukechilds/zsh-nvm\n```\n\n### As an [Oh My ZSH!](https://github.com/robbyrussell/oh-my-zsh) custom plugin\n\nClone `zsh-nvm` into your custom plugins repo\n\n```shell\ngit clone https://github.com/lukechilds/zsh-nvm ~/.oh-my-zsh/custom/plugins/zsh-nvm\n```\nThen load as a plugin in your `.zshrc`\n\n```shell\nplugins+=(zsh-nvm)\n```\n\nKeep in mind that plugins need to be added before `oh-my-zsh.sh` is sourced.\n\n### Manually\nClone this repository somewhere (`~/.zsh-nvm` for example)\n\n```shell\ngit clone https://github.com/lukechilds/zsh-nvm.git ~/.zsh-nvm\n```\nThen source it in your `.zshrc` (or `.bashrc`)\n\n```shell\nsource ~/.zsh-nvm/zsh-nvm.plugin.zsh\n```\n\n## Tests\n\nTo run the tests you'll need to install [Urchin](https://github.com/tlevine/urchin#install). You'll also need to run the tests in an environment that doesn't already have `node` or `nvm` loaded.\n\nYou can remove `nvm` from the existing session with:\n\n```shell\nnvm deactivate \u0026\u0026 nvm unload\n```\n\nRun the tests with:\n\n```shell\nurchin -s zsh tests\n```\n\n\n\n## Related\n\n- [`zsh-better-npm-completion`](https://github.com/lukechilds/zsh-better-npm-completion) - Better completion for `npm`\n\n## License\n\nMIT © Luke Childs\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukechilds%2Fzsh-nvm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flukechilds%2Fzsh-nvm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flukechilds%2Fzsh-nvm/lists"}