diff --git a/README.md b/README.md index 383b44d..64fe1eb 100644 --- a/README.md +++ b/README.md @@ -11,98 +11,206 @@ --- -**Node Version Manager (NVM)** is a versatile tool that empowers developers to manage multiple Node.js versions effortlessly. With NVM, switching between Node.js versions becomes seamless, ensuring compatibility and flexibility for diverse projects. +**Node Version Manager (NVM)** is not just a tool; it's a game-changer for developers who demand precision, flexibility, and efficiency in managing Node.js environments. Whether you're working on legacy systems or cutting-edge applications, NVM ensures your development workflow is seamless and future-proof. --- ## Table of Contents - [Introduction](#introduction) -- [About NVM](#about-nvm) +- [Why Choose NVM?](#why-choose-nvm) - [Installation and Updates](#installation-and-updates) - - [Install & Update Script](#install--update-script) - - [Verify Installation](#verify-installation) - - [Important Notes](#important-notes) - - [Git Installation](#git-installation) - - [Manual Installation](#manual-installation) - - [Manual Upgrade](#manual-upgrade) -- [Usage](#usage) - - [Long-term Support (LTS)](#long-term-support-lts) - - [Migrating Global Packages](#migrating-global-packages) - - [Default Global Packages](#default-global-packages) - - [Using System Node Version](#using-system-node-version) - - [Listing Versions](#listing-versions) - - [Customizing Colors](#customizing-colors) - - [Restoring PATH](#restoring-path) - - [Setting Default Node Version](#setting-default-node-version) - - [Using Node Binary Mirrors](#using-node-binary-mirrors) - - [Working with .nvmrc Files](#working-with-nvmrc-files) - - [Advanced Shell Integration](#advanced-shell-integration) -- [Running Tests](#running-tests) -- [Environment Variables](#environment-variables) -- [Bash Completion](#bash-completion) -- [Compatibility Issues](#compatibility-issues) -- [Installing on Alpine Linux](#installing-on-alpine-linux) -- [Uninstalling NVM](#uninstalling-nvm) -- [Using Docker for Development](#using-docker-for-development) + - [Quick Install](#quick-install) + - [Advanced Installation](#advanced-installation) + - [Verifying Installation](#verifying-installation) +- [Core Features](#core-features) + - [Effortless Version Switching](#effortless-version-switching) + - [Global Package Migration](#global-package-migration) + - [Customizing Your Environment](#customizing-your-environment) + - [Working with `.nvmrc` Files](#working-with-nvmrc-files) +- [Pro Tips for Power Users](#pro-tips-for-power-users) + - [Optimizing Shell Performance](#optimizing-shell-performance) + - [Using NVM in CI/CD Pipelines](#using-nvm-in-cicd-pipelines) + - [Leveraging Node Binary Mirrors](#leveraging-node-binary-mirrors) - [Troubleshooting](#troubleshooting) - - [macOS Troubleshooting](#macos-troubleshooting) - - [WSL Troubleshooting](#wsl-troubleshooting) -- [Maintainers](#maintainers) -- [Project Support](#project-support) -- [Enterprise Support](#enterprise-support) + - [Common Issues and Fixes](#common-issues-and-fixes) + - [macOS-Specific Tips](#macos-specific-tips) +- [Community and Support](#community-and-support) - [License](#license) -- [Copyright Notice](#copyright-notice) --- ## Introduction -NVM simplifies the process of managing Node.js versions, making it an indispensable tool for developers working on varied projects. With just a few commands, you can install, switch, and manage Node.js versions effortlessly. +In the fast-paced world of software development, managing multiple Node.js versions is no longer optional—it's essential. NVM empowers developers to: -**Example Usage:** +- Seamlessly switch between Node.js versions. +- Maintain compatibility across diverse projects. +- Optimize workflows with minimal overhead. -```sh -nvm use 16 -# Now using node v16.9.1 (npm v7.21.1) -node -v -# v16.9.1 -nvm use 14 -# Now using node v14.18.0 (npm v6.14.15) -node -v -# v14.18.0 -nvm install 12 -# Now using node v12.22.6 (npm v6.14.5) -node -v -# v12.22.6 -``` +Whether you're a solo developer or part of a large team, NVM is your go-to solution for Node.js version management. --- -## About NVM +## Why Choose NVM? -NVM is a version manager for [Node.js](https://nodejs.org/en/), designed to be installed per-user and invoked per-shell. It works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash) and supports platforms like Unix, macOS, and [Windows WSL](https://github.com/nvm-sh/nvm#important-notes). +1. **Unparalleled Flexibility**: Switch between Node.js versions with a single command. +2. **Developer-Centric Design**: Tailored for developers, by developers. +3. **Cross-Platform Excellence**: Works flawlessly on Unix, macOS, and Windows WSL. +4. **Future-Ready**: Regular updates and a thriving community ensure NVM stays ahead of the curve. --- ## Installation and Updates -### Install & Update Script +### Quick Install -To **install** or **update** NVM, run the following script using either `curl` or `wget`: +For a hassle-free installation, use the following script: ```sh curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash ``` +Or, if you prefer `wget`: + ```sh wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.2/install.sh | bash ``` -This script clones the NVM repository to `~/.nvm` and updates your shell profile to load NVM automatically. If the script updates the wrong profile file, set the `$PROFILE` environment variable to the correct file path and rerun the script. +### Advanced Installation + +For power users who need more control, clone the repository manually: + +```sh +git clone https://github.com/nvm-sh/nvm.git ~/.nvm +cd ~/.nvm +git checkout v0.40.2 +``` + +Then, add the following to your shell profile: + +```sh +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \ . "$NVM_DIR/nvm.sh" +``` + +### Verifying Installation + +Ensure NVM is installed correctly: + +```sh +command -v nvm +``` + +If the output is `nvm`, you're good to go! --- -For more details, refer to the [full documentation](#table-of-contents). +## Core Features + +### Effortless Version Switching + +Switching Node.js versions is as simple as: + +```sh +nvm use 18 +# Now using node v18.0.0 +``` + +Want to install and use a specific version? No problem: + +```sh +nvm install 16 +# Now using node v16.14.0 +``` + +### Global Package Migration + +Preserve your global packages when switching Node.js versions: + +```sh +nvm install 14 --reinstall-packages-from=12 +``` + +### Customizing Your Environment + +Tailor NVM to your workflow by setting environment variables like `NVM_COLORS` and `NVM_DIR`. For example: + +```sh +export NVM_COLORS="bg=blue;fg=white" +``` + +### Working with `.nvmrc` Files + +Standardize Node.js versions across your team by using `.nvmrc` files: + +```sh +echo "16" > .nvmrc +nvm use +``` + +--- + +## Pro Tips for Power Users + +### Optimizing Shell Performance + +Speed up your shell startup by lazy-loading NVM. Add this snippet to your profile: + +```sh +export NVM_LAZY_LOAD=true +``` + +### Using NVM in CI/CD Pipelines + +Integrate NVM into your CI/CD workflows for consistent environments: + +```sh +nvm install 18 +nvm use 18 +npm ci +npm test +``` + +### Leveraging Node Binary Mirrors + +Work in restricted environments by using custom Node.js mirrors: + +```sh +export NVM_NODEJS_ORG_MIRROR=https://custom-mirror.com/node/ +``` + +--- + +## Troubleshooting + +### Common Issues and Fixes + +- **Problem**: `nvm: command not found` + **Solution**: Ensure your shell profile is sourcing NVM correctly. + +- **Problem**: Slow shell startup. + **Solution**: Enable lazy loading with `export NVM_LAZY_LOAD=true`. + +### macOS-Specific Tips + +If you're using `zsh`, ensure your `.zshrc` includes: + +```sh +export NVM_DIR="$HOME/.nvm" +[ -s "$NVM_DIR/nvm.sh" ] && \ . "$NVM_DIR/nvm.sh" +``` + +--- + +## Community and Support + +Join the vibrant NVM community on [GitHub](https://github.com/nvm-sh/nvm) and [Discord](https://discord.gg/nodejs). Share your experiences, ask questions, and contribute to the project. + +--- + +## License + +NVM is open-source software licensed under the MIT License. See the [LICENSE](LICENSE) file for details. ---