:earth_americas: Cross-platform support (Mac, Windows, Linux)
:sparkles: Single file, easy installation, instant startup
:rocket: Built with speed in mind
@ -22,13 +24,15 @@
@@ -22,13 +24,15 @@
### Using a script (MacOS/Linux)
> :wave: Hey, I'm sorry that the automated way does not support Windows yet. Feel free to contribute it! Maybe [Chocolatey](https://chocolatey.org/) or [Scoop](https://scoop.sh/)?
For `bash`, `zsh` and `fish` shells, there's an [automatic installation script](./.ci/install.sh):
```bash
curl -fsSL https://fnm.vercel.app/install | bash
```
### Upgrade
#### Upgrade
On OSX, it is a simple as `brew upgrade Schniz/tap/fnm`.
- On Windows, the profile is located at `~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1`
- For Mac/Linux, the profile is located at `~/.config/powershell/Microsoft.PowerShell_profile.ps1`
If you are using [fish shell](https://fishshell.com/), create `~/.config/fish/conf.d/fnm.fish` add this line to it:
- For **WinCMD**, aka good old **Windows Command Prompt** or **Batch**, fnm is also supported but is not entirely covered. [You can set up a startup script](https://superuser.com/a/144348) and append the following line:
```fish
fnm env | source
```
```
FOR /f "tokens=*" %i IN ('fnm env --use-on-cd') DO CALL %i
- Providing `--shell=fish` will output the Fish-compliant version. Omitting it and `fnm` will try to infer the current shell based on the process tree
- Providing `--node-dist-mirror="https://npm.taobao.org/dist"` will use the Chinese mirror of Node.js
- Providing `--fnm-dir="/tmp/fnm"` will install and use versions in `/tmp/fnm` directory
You can always use `fnm --help` to read the docs:
### `fnm install [VERSION]`
Installs `[VERSION]`. If no version provided, it will install the version specified in the `.node-version` or `.nvmrc` files located in the current working directory.
### `fnm install --lts`
Installs the latest LTS version of Node
### `fnm use [VERSION]`
Activates `[VERSION]` as the current Node version. If no version provided, it will activate the version specified in the `.node-version` or `.nvmrc` file located in the current working directory.
#### Flags
- `--install-if-missing` — installs the version if it isn't installed yet
### `fnm current`
Display currently activated Node version.
@ -123,20 +174,13 @@ Aliases a Node version to a given name.
@@ -123,20 +174,13 @@ Aliases a Node version to a given name.
Aliases a Node version as default. Uses `fnm alias` underneath.
Prints the required shell commands in order to configure your shell, Bash compliant by default.
- Providing `--shell=fish` will output the Fish-compliant version. Omitting it and `fnm` will try to infer the current shell based on the process tree
- Providing `--node-dist-mirror="https://npm.taobao.org/dist"` will use the Chinese mirror of Node.js
- Providing `--use-on-cd` will also output a script that will automatically change the node version if a `.node-version`/`.nvmrc` file is found
- Providing `--fnm-dir="/tmp/fnm"` will install and use versions in `/tmp/fnm` directory
Prints the required shell commands in order to configure your shell, Bash compliant if can't infer the shell. This command is highly influenced by [the global options](#global-options)
## Future Plans
#### Options:
- [ ] Feature: `fnm use --install`
- [ ] Linux: Replace `tar` with a statically linked library too (for ungzip + untar)
- [ ] Windows Support? @ulrikstrid has worked hard to make it compile on Windows, but it will probably need to have different code paths and logic. We can probably make another program and share feature tests with it, instead of relying on Windows for this very-unixy binary.
- `--use-on-cd` will also output a script that will automatically change the node version if a `.node-version`/`.nvmrc` file is found