A simple and lightweight alternative to Node Version Manager (nvm) for Linux & macOS and NVM for Windows. Supported architectures:
- Linux (armv6l, armv7l, arm64, amd64/x86_64
- Windows (x86_64)
- macOS (x86_64, arm64)
Wanted something to setup my SBC server projects without the overhead of nvm, and I had issues with NVM for Windows.
Works on macOS, Windows, Debian, Fedora, and Arch based systems. Only tested using git-bash (minGW) or Cygwin on Windows. Launching install script in Powershell will spawn a git-bash subprocess, the main anm script will not be added to powershell rc so that may not work directly.
-
Test Systems:
- X86_64 PC: Windows11, Ubuntu 20.04 and 22.04, Fedora 36 and Manjaro
- Raspberry PI 3B, 4B: Raspberry Pi OS, Ubuntu, Manjaro
- Rock64, RockPro64: Armbian, Manjaro
- Pinebook Pro: Manjaro
- macOS Ventura on M1 Macbook Air and an Intel Hackintosh
-
Compatibility for Linux:
- Node v0.8.6+ (x86, x86_64)
- Node v4.0.0+ (armv6l, armv7l, arm64)
- For Windows: this utility cannot install dependencies for windows. These will have to be installed manually.
- For Linux: this utility will check and automatically install all dependencies: python, pip, git, curl and wget.
- For macOS: I think you need to enable XCode CLI utils, accept the terms, so you can use git, python and pip.
-
Install to default user-space. This should install to
$HOME/.anmFor Windows: launch in git-bash for best results and use the
curlversion, git bash does not have wget.curl -o- https://raw.githubusercontent.com/anujdatar/anm/main/install.sh | bashwget -qO- https://raw.githubusercontent.com/anujdatar/anm/main/install.sh | bash -
Install ANM system-wide, for all users. This should install to /opt/anm. Use the following:
NOTE: For Linux only. And, most ANM actions, and
npm install -gwill requiresudoprivileges.curl -o- https://raw.githubusercontent.com/anujdatar/anm/main/install.sh | bash -s systemwget -qO- https://raw.githubusercontent.com/anujdatar/anm/main/install.sh | bash -s system -
Custom location:
- Clone git repository
- Make
install.shan executable.chmod +x install.sh - Run the install script.
./install.sh
-
If you want to use the script without installing, just clone the repository, install dependencies mentioned above, create files named
installedandactive. Makeanm.shand executable filechmod +x anm.sh. You should now be able to run ANM from the directory./anm.sh ls-remote,./anm.sh install --lts, etc.
- List locally installed node versions / releases. Should tell you active version as well.
anm ls - List node versions available for install from www.nodejs.org
- List all available options
anm ls-remote - List all LTS releases
anm ls-remote --lts - List latest LTS release for a particular version
anm ls-remote --lts <release name> # gallium, fermium, argon, etc - List latest release of each version
anm ls-remote --latest
- List all available options
- Install a version of NodeJs
- Install the latest available release
anm install - Install the latest LTS version release
anm install --lts - Install the latest release of a specific LTS version
anm install --lts <release name> # gallium, fermium, argon, etc - Install a specific release by version number
anm install v16.15.0 # or 18.2.0, v-prefix not necessary
- Install the latest available release
- Uninstall an installed version of NodeJs
anm uninstall <version number> # v16.15.0 or 14.19.3, v-prefix not necessary - Use a particular version of NodeJs, if you already have a few installed
anm use <version number> # v16.15.0 or 18.2.0, v-prefix not necessary - Deactivate a currently installed version of NodeJs if managed by ANM
anm deactivate <version number> # v16.15.0 or 18.2.0, v-prefix not necessary - Other misc. commands
anm upgrade # upgrade to latest ANM versionanm --version # print version of ANM that is installedanm --path # print path where ANM is installed, NodeJs binaries in a subfolder hereanm --help # print help message
The convenience script does the following in case you want to install manually.
- Update/upgrade system (on Linux only)
- Install missing dependencies using your package manager (apt/dnf/pacman) (on Linux only)
-
curl,wget,git,jq,python3,python3-pip(python-pipif using Arch). Ironically you need eithercurlorwgetto get started. 😝 - Install
packagingandurllib3usingpip.pip3 install packaging urllib3 - Clone the ANM git repo to
$HOME/.anm(Windows and Linux)./opt/anmif Linux-system-wide-installation. This step is skipped if you are installing from the repo-clone.
- Makes
anm.shan executable (chmod +x /<path>/anm.sh). And creates a symlink in$HOME/.anm/binln -s $HOME/.anm/anm.sh $HOME/.anm/bin/anm- or
/opt/anm/binif system-wide install on Linux
- Adds the following to your shell rc profile (
.bashrc,.zshrc,.profile). This is required for anm detect install location and work correctly.# >>>>>>>> Block added by ANM install >>>>>>>> if ! [[ "$PATH" =~ "$install_path/bin" ]]; then [ -d "$install_path/bin" ] && export PATH="$install_path/bin:$PATH" fi if ! [[ "$PATH" =~ "$install_path/versions/current" ]]; then [ -d "$install_path/bin" ] && export PATH="$install_path/versions/current:$PATH" fi if [ -d "$install_path" ]; then export ANM_DIR="$install_path"; fi # >>>>>>>>>>>>>> End ANM block >>>>>>>>>>>>>>>
- or
/etc/profile.d/anm_profile.sh, if system-wide installation on Linux - Currently
bashandzshare supported. Other shell users should make sure$HOME/.profileand/or/etc/profileare loaded when shell is launched.
- or
Note: On Windows, the default installation directory is
C:\Users\<username>\anmregardless of if you are usinggit-bash(which ismingwI believe) or if you havecygwininstalled separately (inC:\cygwin). But the rc file that gets updated will depend on the terminal emulator you use. If you usegit-bashyour rc file should beC:\Users\<username>\.bashrcorC:\Users\<username>\.zshrc. But if you usecygwinyou default might beC:\cygwin64\home\<username>\.bashrcorC:\cygwin64\home\<username>\.zshrc. So if you want it to operate in both environments, you will have to add the block to the other rc files manually.In your rc files on
git-bash/mingwyou install path should look like/c/Users/<username>/.anm. Whereas oncygwinit should be/cygdrive/c/Users/<username>/.anmso the block above may look different and also needs to be that way. All installed nodejs versions will be stored in the/.anm/versions/node/directory. Defaultcorepackbinary does not seem to work on Windows incygwinat the moment.crlfvslfline ending issue. Works ingit-bash(mingw) though.
You might have to restart your system, or logout and log back in, or just close shell and reopen. Depends. You should be able to use anm from command line after this.
Unfortunately this has to be manual for now
- Remove the installed directory
rm -rf /home/$USER/.anm - Remove the block added by ANM from your RC file (
$HOME/.bashrcor$HOME/.zshrcor$HOME/.profile). Or delete/etc/profile.d/anm_profile.shfor system-wide installation on Linux
- Look into aliasing installed node versions
Uses some ideas from NVM, but works differently. Was initially inspired by their work. But when I started this project, I had issues with NVM on some of my RockChip based SBCs. It works perfectly now, but I had a few different ideas I wanted to try out for my local servers.
Unlike NVM, ANM does not load it's entire code to the shell profile every time you launch terminal. But has very limited functionality compared to NVM. Probably not the most elegant solution, but a learning process for me.

