Skip to content

Commit

Permalink
More setup documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
jasongin committed Oct 24, 2016
1 parent c3974d0 commit 1afacb7
Show file tree
Hide file tree
Showing 2 changed files with 71 additions and 55 deletions.
60 changes: 5 additions & 55 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,71 +13,21 @@ NVS has three significant advantages over similar tools:

This tool is obviously inspired by other node version manager tools, especially [**nvm**](https://github.com/creationix/nvm), from which it borrows a lot of ideas and some command-line syntax.

## Installation
NVS currently works on any platform for which Node.js binaries are available. The ability to build and install Node.js from source may be added later.

Before installing, decide on either a single-user installation or a system installation. For individual development, a single-user installation is recommended because then NVS does not require root/admin privileges for any commands. However if multi-user capability is desired, or if NVS should be able to link a version as a system Node.js installation, then it may be installed to a system folder.

By default, downloaded Node.js files are cached under the NVS installation directory. To override this behavior, set the `NVS_HOME` environment variable to another location.
## Setup
Following are basic setup instructions. [For more details and options for setting up NVS, refer to the Setup page.](https://github.com/jasongin/nvs/blob/master/doc/SETUP.md)

### Windows
A Windows installer package may be available later. Until then these manual steps are simple. Regardless of whether it is initially installed from Command Prompt or PowerShell, NVS will work from either shell afterward.

#### Command Prompt
1. Specify the installation path using *one* of the following commands, for either a single-user or system installation:
```cmd
set NVS_HOME=%LOCALAPPDATA%\nvs
set NVS_HOME=%ProgramFiles%\nvs
```
2. Clone this repo:
```cmd
git clone https://github.com/jasongin/nvs "%NVS_HOME"
```
3. Run the `install` command:
```cmd
"%NVS_HOME%\nvs.cmd" install
```

#### PowerShell

1. Specify the installation path using *one* of the following commands, for either a single-user or system installation:
```powershell
$env:NVS_HOME="$env:LOCALAPPDATA\nvs"
$env:NVS_HOME="$env:ProgramFiles\nvs"
```
2. Clone this repo:
```powershell
git clone https://github.com/jasongin/nvs "$env:NVS_HOME"
```
3. Run the `install` command:
```powershell
. "$env:NVS_HOME\nvs.ps1" install
```

After installation, running just `nvs` from the current shell or any new Command Prompt or PowerShell then invokes either the `nvs.cmd` or `nvs.ps1` script accordingly.

#### Bash on Windows

NVS can also work in [Unbutu Bash on Windows 10](https://msdn.microsoft.com/en-us/commandline/wsl/about) using the following installation instructions. Of course then that instance of NVS and any Node.js versions it installs in that environment are only available to the Ubuntu subsystem.
A Windows Installer (MSI) package is available from the [NVS releases page on GitHub](https://github.com/jasongin/nvs/releases).

### Mac, Linux
1. Specify the installation path using *one* of the following commands, for either a single-user or system installation:
Specify the installation path, clone the repo, and *source* the `install` command:
```sh
export NVS_HOME="$HOME/.nvs"
export NVS_HOME="/usr/local/nvs"
```
2. Clone this repo:
```sh
git clone https://github.com/jasongin/nvs "$NVS_HOME"
```
3. Source the `install` command:
```sh
. "$NVS_HOME/nvs.sh" install
```

The `nvs.sh` script adds a shell function to the environment. Afterward the tool should be invoked as `nvs`, without any path. The `install` command also adds lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to source `nvs.sh` so that the `nvs` function is available in future shells.

Note there is also an executable shell script named `nvs` (without the `.sh`), that may be used to invoke the tool without having to first *source* `nvs.sh`. However, when invoked in that way the script cannot update the caller's environment, so the `nvs use` command is disabled. And there is a `nvsudo` shell function that invokes `nvs` under `sudo` while preserving the `PATH` (and thus the *current* node version). The latter may be helpful when NVS is installed in a system directory.
The `nvs.sh` script adds an `nvs` shell function to the environment. Afterward the tool should be invoked as just `nvs` without any path. The `install` command adds lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to source `nvs.sh`, so that the `nvs` function is available in future shells.

## Command-line usage
Command | Description
Expand Down
66 changes: 66 additions & 0 deletions doc/SETUP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# NVS Setup
NVS currently works on any platform for which Node.js binaries are available. The ability to build and install Node.js from source may be added later.

Before installing, decide on either a single-user installation or a system installation:
* For individual development, a single-user installation is recommended because then NVS does not require root/admin privileges for any commands.
* If multi-user functionality is desired, or if NVS should be able to link a version as a system Node.js installation, then it may be installed to a system folder. Adding, removing, or linking node versions will then require root/admin privileges, but *using* a node version will not.

By default, downloaded Node.js files are cached under the NVS installation directory. To override this behavior, set the `NVS_HOME` environment variable to another location.

## Windows
Download and run the Windows Installer (MSI) package from the [Releases page on GitHub](https://github.com/jasongin/nvs/releases). Note the single MSI package supports both x86 and x64 systems and both per-user and per-machine installations.

### Manual setup - Command Prompt
1. Specify the installation path using *one* of the following commands, for either a single-user or system installation:
```cmd
set NVS_HOME=%LOCALAPPDATA%\nvs
set NVS_HOME=%ProgramFiles%\nvs
```
2. Clone this repo:
```cmd
git clone https://github.com/jasongin/nvs "%NVS_HOME"
```
3. Run the `install` command:
```cmd
"%NVS_HOME%\nvs.cmd" install
```

### Manual setup - PowerShell
1. Specify the installation path using *one* of the following commands, for either a single-user or system installation:
```powershell
$env:NVS_HOME="$env:LOCALAPPDATA\nvs"
$env:NVS_HOME="$env:ProgramFiles\nvs"
```
2. Clone this repo:
```powershell
git clone https://github.com/jasongin/nvs "$env:NVS_HOME"
```
3. Run the `install` command:
```powershell
. "$env:NVS_HOME\nvs.ps1" install
```

After installation, running just `nvs` from the current shell or any new Command Prompt or PowerShell then invokes either the `nvs.cmd` or `nvs.ps1` script accordingly.

### Bash on Windows

NVS can also work in [Unbutu Bash on Windows 10](https://msdn.microsoft.com/en-us/commandline/wsl/about) using the following installation instructions. Of course then that instance of NVS and any Node.js versions it installs in that environment are only available to the Ubuntu subsystem.

## Mac, Linux
1. Specify the installation path using *one* of the following commands, for either a single-user or system installation:
```sh
export NVS_HOME="$HOME/.nvs"
export NVS_HOME="/usr/local/nvs"
```
2. Clone this repo:
```sh
git clone https://github.com/jasongin/nvs "$NVS_HOME"
```
3. Source the `install` command:
```sh
. "$NVS_HOME/nvs.sh" install
```

The `nvs.sh` script adds an `nvs` shell function to the environment. Afterward the tool should be invoked as just `nvs` without any path. The `install` command also adds lines to your `~/.bashrc`, `~/.profile`, or `~/.zshrc` file to source `nvs.sh`, so that the `nvs` function is available in future shells.

Note there is also an executable shell script named `nvs` (without the `.sh`), that may be used to invoke the tool without having to first *source* `nvs.sh`. However, when invoked in that way the script cannot update the caller's environment, so the `nvs use` command is disabled. And there is a `nvsudo` shell function that invokes `nvs` under `sudo` while preserving the `PATH` (and thus the *current* node version). The latter may be helpful when NVS is installed in a system directory.

0 comments on commit 1afacb7

Please sign in to comment.