LoginSignup
0
0

More than 1 year has passed since last update.

Node Version Management "fnm" 【WSL2 ubuntu 20.04】

Last updated at Posted at 2022-04-07

Library

Install

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

Setting

$ vim ~/.bashrc

__fnm_use_if_file_found() {
    if [[ -f .node-version || -f .nvmrc ]]; then
        fnm use
    fi
}

__fnmcd() {
    \cd "$@" || return $?
    __fnm_use_if_file_found
}

alias cd=__fnmcd
__fnm_use_if_file_found

$ source ~/.bashrc

Usage

Change your directory

$ cd ~/<Your project folder>

Create .node_version file

$ touch .node_version

<Your project folder>/.node_version

16.14.0

Node install

$ fnm install

=> Installing Node v16.14.0 (x64)

Use node this version

$ fnm use

=> Using Node v16.14.0

Check your node version

$ node -v

=> v16.14.0

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0