A PowerShell script to install and configure Fast Node Manager (fnm) on Windows.
This script is intended to make it easy to set up fnm on a user’s machine. It handles detection of existing Node.js managers, installation via winget, and configuration of shell startup files so that fnm works automatically.
- Detects and warns if nvm-windows is installed (recommends uninstalling to avoid conflicts).
- Detects and warns if a system Node.js install is present (if fnm isn’t installed yet).
- Installs fnm via winget if not already installed.
- Configures
fnm envfor:- PowerShell (Windows PowerShell 5.x and PowerShell 7+ profiles, OneDrive-aware).
- Command Prompt (via
profile.cmd+ registry AutoRun). - Git Bash (
~/.bashrc).
- Adds the flag
--version-file-strategy=recursivetofnm envfor project-based version resolution. - Reloads the current PowerShell profile so
fnmis available immediately in the same session. - Optionally installs and sets a default Node.js version (e.g.
22,lts, orlatest). - Supports DryRun and DetectOnly modes.
Which shells to configure. Accepts one or more of:
pwsh– PowerShell (Windows PowerShell 5.x and PowerShell 7+)cmd– Command Promptgitbash– Git Bash
Default: pwsh,cmd,gitbash
-Shells pwsh,cmdInstall and set a default Node.js version using fnm.
-NodeVersion 22
-NodeVersion ltsOnly check for nvm, fnm, and Node.js. Print findings and exit.
No installations, file edits, or registry changes are made.
-DetectOnlyPreview what changes would be made (file writes, registry edits, installs).
No actual modifications are made.
-DryRun.\Setup-FnmWindows.ps1 -DetectOnly.\Setup-FnmWindows.ps1 -Shells pwsh,cmd -DryRun.\Setup-FnmWindows.ps1 -Shells pwsh,cmd,gitbash -NodeVersion 22.\Setup-FnmWindows.ps1 -Shells pwsh- For PowerShell, the script reloads your profile, so you can run
fnm --versionimmediately. - For cmd and Git Bash, you must open a new terminal window after running the script.
Validate installation with:
fnm --version
node --version- If nvm-windows is detected, you should uninstall it before using fnm (they conflict in how they manage Node.js).
- If a system Node.js is detected and fnm is not installed yet, the script recommends uninstalling system Node to avoid conflicts.
- Requires winget (App Installer) to install fnm. If missing, install App Installer from the Microsoft Store.
- Requires the ability to executes scripts on your local machine, Set-Execution Policy.
MIT – use at your own risk. Contributions welcome!