• Stars
    star
    15,628
  • Rank 1,853 (Top 0.04 %)
  • Language
    Rust
  • License
    GNU General Publi...
  • Created almost 6 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Fast Node Manager (fnm) Amount of downloads GitHub Actions workflow status

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

Blazing fast!

Features

🌎 Cross-platform support (macOS, Windows, Linux)

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.

First ensure that curl and unzip are already installed on you operating system. Then execute:

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

Upgrade

On macOS, it is as simple as brew upgrade 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 (macOS/Linux)

brew install fnm

Then, set up your shell for fnm

Using Winget (Windows)

winget install Schniz.fnm

Using Scoop (Windows)

scoop install fnm

Then, set up your shell for fnm

Using Chocolatey (Windows)

choco install fnm

Then, set up your shell for fnm

Using Cargo (Linux/macOS/Windows)

cargo install fnm

Then, set up your shell for fnm

Using a release binary (Linux/macOS/Windows)

Removing

To remove fnm (😢), just delete the .fnm folder in your home directory. You should also edit your shell configuration to remove any references to fnm (ie. read Shell Setup, and do the opposite).

Completions

fnm ships its completions with the binary:

fnm completions --shell <SHELL>

Where <SHELL> can be one of the supported shells:

  • bash
  • zsh
  • fish
  • powershell

Please follow your shell instructions to install them.

Shell Setup

Environment variables need to be setup before you can start using fnm. This is done by evaluating the output of fnm env. To automatically run fnm use when a directory contains a .node-version or .nvmrc file, add the --use-on-cd option to your shell setup.

Adding a .node-version to your project is as simple as:

$ node --version
v14.18.3
$ node --version > .node-version

Check out the following guides for the shell you use:

Bash

Add the following to your .bashrc profile:

eval "$(fnm env --use-on-cd)"

Zsh

Add the following to your .zshrc profile:

eval "$(fnm env --use-on-cd)"

Fish shell

Create ~/.config/fish/conf.d/fnm.fish add this line to it:

fnm env --use-on-cd | source

PowerShell

Add the following to the end of your profile file:

fnm env --use-on-cd | Out-String | Invoke-Expression
  • On Windows, the profile is located at ~\Documents\PowerShell\Microsoft.PowerShell_profile.ps1 or $PROFILE
  • For macOS/Linux, the profile is located at ~/.config/powershell/Microsoft.PowerShell_profile.ps1

Windows Command Prompt aka Batch aka WinCMD

fnm is also supported but is not entirely covered. You can set up a startup script and append the following line:

FOR /f "tokens=*" %i IN ('fnm env --use-on-cd') DO CALL %i

⚠️ If you get the error i was unexpected at this time, please make a .cmd file as suggested by the first step in the Usage with Cmder secton add it's path to the AutoRun registry key.

Usage with Cmder

Usage is very similar to the normal WinCMD install, apart for a few tweaks to allow being called from the cmder startup script. The example assumes that the CMDER_ROOT environment variable is set to the root directory of your Cmder installation. Then you can do something like this:

  • Make a .cmd file to invoke it
:: %CMDER_ROOT%\bin\fnm_init.cmd
@echo off
FOR /f "tokens=*" %%z IN ('fnm env --use-on-cd') DO CALL %%z
  • Add it to the startup script
:: %CMDER_ROOT%\config\user_profile.cmd
call "%CMDER_ROOT%\bin\fnm_init.cmd"

You can replace %CMDER_ROOT% with any other convenient path too.

Usage

See the available commands for an extended usage documentation

Contributing

PRs welcome 🎉

Developing:

# Install Rust
git clone https://github.com/Schniz/fnm.git
cd fnm/
cargo build

Running Binary:

cargo run -- --help # Will behave like `fnm --help`

Running Tests:

cargo test

More Repositories

1

cuery

A composable SQL query builder using template literals ✨
TypeScript
217
star
2

cmd-ts

💻 A type-driven command line argument parser
TypeScript
206
star
3

gpkg

🌎 A global Node binary manager written in Rust
Rust
63
star
4

react-gooey-nav

The React Gooey Navigation Menu™
TypeScript
55
star
5

remastered

A full-stack approach to React development
TypeScript
50
star
6

svgify

service to threshold-svg your images
JavaScript
28
star
7

pointguard

An MVP-worthy background job server for PostgreSQL, written in Rust
Rust
27
star
8

next-static-paths

Statically prevent 404s in your Next.js applications using TypeScript
TypeScript
23
star
9

factoree

💥🔒 Fail early, fail fast: type-safe and runtime-safe partial factories for TypeScript
TypeScript
23
star
10

fnm.rs

An experimental Rust implementation of fnm
Rust
20
star
11

sapapa

A soothing CouchDB client for Reason and OCaml
OCaml
17
star
12

bs-faker

Faker.js bindings for BuckleScript in Reason
Reason
17
star
13

migratype

🔒▶🔒 Safe runtime type migrations for TypeScript
TypeScript
13
star
14

benchy-action

a hassle-free GitHub Action to benchmark your code continuously.
TypeScript
12
star
15

reason-pr-labels

Look for PR labels in GitHub pull requests
OCaml
12
star
16

dotfiles

my dotfiles
Shell
11
star
17

httyped

⛓️ Type-safe HTTP client/server communications with awesome autocompletion
TypeScript
11
star
18

route-ts

TypeScript
9
star
19

simpleplan

Simple dependency injector for your precious node apps.
JavaScript
8
star
20

draft-js-create-inline-style-plugin

Handle Draft.js' inline styles as if they were controlled by strategies 💥
JavaScript
7
star
21

libre-converter

Converting LibreOffice documents to other formats. like PDF and stuff. yeah.
CoffeeScript
7
star
22

infer-types

Returns the exported inferred types from TypeScript.
TypeScript
6
star
23

need-this

One Store To Rule Them All
JavaScript
6
star
24

soundtype-commander

A type-safe wrapper around commander.js with excellent type inference.
TypeScript
6
star
25

lets-chat-reverseproxy

reverse proxy sso header add-on for Let's Chat
JavaScript
5
star
26

obsidian-prettier

TypeScript
4
star
27

matcher-ts

TypeScript
4
star
28

soundtype-eventemitter

A typesafe event emitter for TypeScript
TypeScript
4
star
29

draft-js-lister-plugin

automatic unordered and ordered lists in draftjs based on draft-js-plugins
JavaScript
4
star
30

tgrm

TypeScript
4
star
31

react-contexter

Use Context with Higher Order Components for better testing and reuse.
JavaScript
4
star
32

fnm-playground

I want to add Changesets so I'll do it in a different repo to test
Rust
3
star
33

circleci_redirection

Use Circle CI's artifact system to host binaries and documentation
Crystal
3
star
34

home-automation-cluster

My home automation cluster
TypeScript
3
star
35

functional-programming-smalltalks

small talks about fp in js for Keywee
3
star
36

magic-string-playground

TypeScript
2
star
37

reql-pointfree

Functional RethinkDB functions for point free programming
JavaScript
2
star
38

ical_http_server

another project to play with rust
Rust
2
star
39

neder

really simple and jewish javascript promises
JavaScript
2
star
40

homebrew-tap

A custom homebrew tap
2
star
41

telegram-to-facebook-bot

Post links tagged with `#fullstack` in your Telegram froup to your Facebook group
JavaScript
2
star
42

fb-group-poster

Posts to a facebook group using your credentials using Selenium WebDriver
JavaScript
2
star
43

serverless-graphql-demo

JavaScript
2
star
44

js-playgrounds

Experimental editor agnostic in-line evaluation: like Swift playgrounds, only for JS!
JavaScript
2
star
45

nextjs-example-fetching-gzipped

JavaScript
1
star
46

decompress-wasm-example

JavaScript
1
star
47

streaming-tester

TypeScript
1
star
48

windows-vc-dev-modules-repro

JavaScript
1
star
49

new-dotfiles

Shell
1
star
50

prs_look_for_labels

Look for PR labels in GitHub pull requests
Crystal
1
star
51

jt

small and easy jira ticket helper for bash
Shell
1
star
52

kiwi_json.cr

Save and load typed objects from Kiwi stores
Crystal
1
star
53

delegator.cr

Decorates an object and delegates missing methods to it
Crystal
1
star
54

cargo-mdbook

Distribute https://github.com/rust-lang/mdBook as a npm dependency
TypeScript
1
star
55

redis_mutex.cr

Distributed mutex in Ruby using Redis for Crystal
Crystal
1
star
56

ramda-immutable

Immutable.js helpers for Ramda
JavaScript
1
star
57

test-css-modules

JavaScript
1
star
58

docker-node-gyp

A node docker image with the headers already installed in
1
star
59

m1-node-versions

1
star
60

chrome-fulfill-request-issue

JavaScript
1
star
61

beg-to-differ

Simple string diff patching for node.js
JavaScript
1
star
62

merged_branches.rs

🚮 Delete merged branches from GitHub. Squashed too.
Rust
1
star