You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
Wes Baker 136ea03080
Use separate config file for fish config (#266)
4 years ago
.ci Use separate config file for fish config (#266) 4 years ago
.github/workflows Run CI on pull_request and push[master] (#268) 4 years ago
docs Update scripts for release 4 years ago
site Update all non-major dependencies (#262) 4 years ago
src Rewrite fnm in Rust (merge fnm.rs into fnm) — adding Windows support! (#246) 4 years ago
tests Rewrite fnm in Rust (merge fnm.rs into fnm) — adding Windows support! (#246) 4 years ago
.gitattributes Rewrite fnm in Rust (merge fnm.rs into fnm) — adding Windows support! (#246) 4 years ago
.gitignore Rewrite fnm in Rust (merge fnm.rs into fnm) — adding Windows support! (#246) 4 years ago
.node-version Update Node.js to v12.19.0 (#250) 4 years ago
CHANGELOG.md Update scripts for release 4 years ago
Cargo.lock Update all non-major dependencies (#267) 4 years ago
Cargo.toml Update all non-major dependencies (#267) 4 years ago
LICENSE Add a GPL v3 LICENSE file (#22) 6 years ago
README.md Use separate config file for fish config (#266) 4 years ago
build.rs Rewrite fnm in Rust (merge fnm.rs into fnm) — adding Windows support! (#246) 4 years ago
fnm-manifest.rc Rewrite fnm in Rust (merge fnm.rs into fnm) — adding Windows support! (#246) 4 years ago
fnm.manifest Rewrite fnm in Rust (merge fnm.rs into fnm) — adding Windows support! (#246) 4 years ago
package.json Pin Node dependencies (#249) 4 years ago
renovate.json Group all non major 4 years ago
yarn.lock Pin Node dependencies (#249) 4 years ago

README.md

Fast Node Manager (fnm) Amount of downloads Build Status

🚀 Fast and simple Node.js version manager, built in Rust

Blazing fast!

Features

Single file, easy installation, instant startup

🚀 Built with speed in mind

🤔 Works with .node-version and .nvmrc files

Installation

Using a script (MacOS/Linux)

For bash, zsh and fish shells, there's an automatic installation script:

curl -fsSL https://fnm.vercel.app/install | bash

Upgrade

On OSX, it is a simple as brew upgrade Schniz/tap/fnm.

On other operating systems, upgrading fnm is almost the same as installing it. To prevent duplication in your shell config file add --skip-shell to install command.

Parameters

--install-dir

Set a custom directory for fnm to be installed. The default is $HOME/.fnm.

--skip-shell

Skip appending shell specific loader to shell config file, based on the current user shell, defined in $SHELL. e.g. for Bash, $HOME/.bashrc. $HOME/.zshrc for Zsh. For Fish - $HOME/.config/fish/conf.d/fnm.fish

--force-install

MacOS installations using the installation script are deprecated in favor of the Homebrew formula, but this forces the script to install using it anyway.

Example:

curl -fsSL https://fnm.vercel.app/install | bash -s -- --install-dir "./.fnm" --skip-shell

Manually

Using Homebrew (OSX)

This is a custom tap I'm maintaining, and will be used until fnm will move to the official one.

brew install Schniz/tap/fnm

Then apply the changes the installer prints, to set up your shell profile.

Using a release binary

  • Download the latest release binary for your system

  • Make it available globally on $PATH

  • Add the following line to your .bashrc/.zshrc file:

    eval "$(fnm env --multi)"
    

    If you are using fish shell, create ~/.config/fish/conf.d/fnm.fish add this line to it:

    fnm env --multi | source
    

Completions

Usage

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 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.

fnm current

Display currently activated Node version.

fnm ls

Lists the installed Node versions.

fnm ls-remote

Lists the Node versions available to download remotely.

fnm uninstall [VERSION]

Uninstalls the node version specified in [VERSION].

fnm alias [VERSION] [NAME]

Aliases a Node version to a given name.

fnm default [VERSION]

Aliases a Node version as default. Uses fnm alias underneath.

fnm env [--multi] [--shell=fish|bash|zsh] [--node-dist-mirror=URI] [--use-on-cd] [--fnm-dir=DIR] [--log-level=quiet|error|all]

Prints the required shell commands in order to configure your shell, Bash compliant by default.

  • Providing --multi will output the multishell support, allowing a different current Node version per shell
  • 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

Future Plans

  • 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.

Contributing

PRs welcome 🎉

Developing:

npm install -g esy
git clone https://github.com/Schniz/fnm.git
cd fnm/
esy install
esy bootstrap
esy build

Running Binary:

After building the project, you can run the main binary that is produced.

esy x fnm.exe

Running Tests:

# Runs some smoke-unity test
esy test

# Runs the feature tests
feature_tests/run.sh