NVM - Accuraty/AccuTheme-Bs4 GitHub Wiki

[WIP] Node Version Manager (NVM) Setup

Quick Overview

In brief, NVM allows you to switch which version of NodeJS you are using. Since the modern Node LTS version (as of May 2021) is now v14+ and AccuTheme still has dependencies (is using programs and modules) that (as is) do not work properly after NodeJS v12.x, we need to update our environment so VS Code and the Terminal window use v12.x with this project, even after your local machine has NodeJS v14, v16, etc installed.

Note: this is fairly common. We recently started working on CHRC's theme in Antilles and that project still requires NodeJS v8.x.

Steps and Notes for Windows [WIP]

Install the recommended Windows NVM: GitHub coreybutler/nvm-windows

MS reference info if you want to read more: Install NodeJS on Windows

VS Code April 2021 (version 1.56) - Terminal Profile Improvements

Update VSCode Settings for Integrated Terminals - in VS Code, go to Settings (Ctrl - ,), make sure you are in User Settings, search for @feature:terminal profiles, under the Windows section click the Edit in settingsjson. This will add the new default (these are new features in 2021 and replace older features like cwd, shellArgs, and shell) section which you should modify to look like this:

  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell",
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-powershell"
    },
    "Git Bash": {
      "source": "Git Bash"
    }
  },
  "terminal.integrated.defaultProfile.windows": "PowerShell",

Confirm you are in your AccuTheme project? Now edit the ABBV202x.code-workspace file in the root of the project. At the bottom, after the "settings" section, add...

  "terminal.integrated.profiles.windows": {
    "PowerShell": {
      "source": "PowerShell",
      "icon": "terminal-powershell",
      "args": [
        "-NoExit",
        "-Command", "nvm ls",
      ],
    },
    "Command Prompt": {
      "path": [
        "${env:windir}\\Sysnative\\cmd.exe",
        "${env:windir}\\System32\\cmd.exe"
      ],
      "args": [],
      "icon": "terminal-powershell",
    },
    "Git Bash": {
      "source": "Git Bash"
    }
  },

Save, exit all terminals and start a new one. If Windows ask you to confirm/allow things, answer yes (twice?).

If your new terminal does NOT display like this, check in with JRF.

Now using node v12.22.1 (64-bit)
PS C:\GitHubLocal\{ABBV202x}>

NodeJS Verson Management

How do I see what version(s) of NodeJS I have installed?

At the command prompt just type

> nvm ls

How do I see what versions of NodeJS are available to install?

> nvm list available

How do I install a specific version of NodeJS?

We usually pick something from the LTS column and also the highest version of the major. So if we need v12, we'd install the highest 12.xx.xx in the LTS column like this:

> nvm install 12.22.1

To Switch Versions manually, as needed

> nvm use 14.17.1

⚠️ **GitHub.com Fallback** ⚠️