PolyNode is a Node.js version manager that does not require sudo/admin privileges and is installed on a per-user basis. Works on AIX, Linux, macOS, and Windows.
- Quick demo
- Project structure
- Supported operating systems and CPU architectures
- How to install
- How to use
- Upgrading PolyNode
- Searching for available Node.js versions
- Downloading a new version of Node.js
- Setting your default Node.js version
- Temporarily setting your Node.js version
- Downloading and setting your default Node.js to a new version
- Printing your current version of Node.js
- Printing all downloaded versions of Node.js
- Deleting a downloaded version of Node.js
- Printing your current version of PolyNode
- How to configure
- How to uninstall
- Building from source
- Contributing
- Acknowledgements
.
├── CODE_OF_CONDUCT.md
├── Dockerfile
├── LICENSE
├── README.md
├── SECURITY.md
├── cmd
│ └── polyn
│ ├── helpers.go
│ └── main.go
├── demo.gif
├── go.mod
├── install
│ ├── cmd
│ │ └── setup
│ │ ├── helpers.go
│ │ ├── helpers_windows.go
│ │ ├── setup.go
│ │ └── setup_windows.go
│ ├── go.mod
│ ├── go.sum
│ └── internal
│ └── constants
│ └── constants.go
├── internal
│ ├── constants
│ │ └── constants.go
│ ├── homeDir-prod.go
│ ├── homeDir.go
│ ├── models
│ │ ├── aliases.go
│ │ ├── nodeVersion.go
│ │ └── polyNodeConfig.go
│ ├── node
│ │ ├── commands.go
│ │ ├── helpers.go
│ │ └── node.go
│ └── utilities
│ └── utils.go
├── scripts
│ ├── aix
│ │ └── bundle
│ ├── linux
│ │ └── bundle
│ ├── mac
│ │ └── bundle
│ └── win
│ └── bundle.cmd
└── uninstall
├── go.mod
├── go.sum
├── uninstall.go
└── uninstall_windows.go
- AIX (Power 64-bit)
- Linux (x64, ARM64, Power LE 64-bit, and s390x)
- macOS (x64 and ARM64)
- Windows 10 and newer (x64 and ARM64)
PolyNode does not require sudo/admin privileges to install.
Please uninstall all Node.js downloads that weren't installed by PolyNode before running the setup binary.
- Navigate to the latest release.
- Download the AIX .tar.gz file.
- Extract the .tar.gz file and run the setup binary.
PolyNode only supports Bash, Zsh, or KornShell by default. During the install process, PolyNode edits either .bashrc, .zshrc, or .kshrc to add two locations to the PATH: PolyNode's home directory $HOME/.PolyNode
and the symlink for Node.js $HOME/.PolyNode/nodejs/bin
. You can get PolyNode to work for other shells by adding these directories to your PATH environment variable.
- Navigate to the latest release.
- Download the Linux .tar.xz file appropriate for your CPU architecture.
- Extract the .tar.xz file and run the setup binary.
- Navigate to the latest release.
- Download the Darwin .tar.gz file appropriate for your CPU architecture.
- Extract the .tar.gz file and run the setup binary.
- Navigate to the latest release.
- Download the Windows .zip file appropriate for your CPU architecture.
- Extract the .zip file and run setup.exe.
PolyNode does not require sudo/admin privileges to use the polyn
command.
polyn upgrade
polyn search [prefix]
Using a prefix will match anything with this prefix. So polyn search 1
will match with any Node.js version that starts with "1".
If you want to search for a specific major version, add a "." at the end of your prefix. polyn search 18.
will print all Node.js v18 releases.
A default list will print if no prefix is given.
This command will only download a new version of Node.js. It will not set the new version as your currently-used version. See Setting your default Node.js version or Temporarily setting your Node.js version on how to use the Node.js you download.
polyn add <version or keyword or prefix>
# Downloading a specific version of Node.js.
polyn add 23.7.0
# Downloading the latest Node.js release that matches a prefix.
polyn add 23
# Downloading the latest Node.js LTS release.
polyn add lts
# Downloading the latest Node.js release.
polyn add latest
This command will set your Node.js version across all shell processes. All new shell processes will automatically use this Node.js version, unless overriden by temporarily setting the Node.js version.
polyn use <version or prefix>
# Setting your default to a specific Node.js version.
polyn use 23.7.0
# Setting your default to the latest Node.js release that matches a prefix.
polyn use 23
This command will temporarily set your Node.js version for your current shell process and all child processes of that shell. This will only set your Node.js version for the lifetime of the shell. For a more permanent solution, see Setting your default Node.js version.
This command is useful if you need to run two separate projects at the same time that depend on different versions of Node.js.
eval $(polyn temp <version or prefix>)
# Temporarily setting your Node.js to a specific version.
eval $(polyn temp 23.7.0)
# Temporarily setting your Node.js to the latest release that matches a prefix.
eval $(polyn temp 23)
Unfortunately, Windows doesn't have a command equivalent to the POSIX eval
. You will have to run polyn temp <version or prefix>
and then copy and paste the command it outputs.
This command downloads a specific version of Node.js and immediately sets it as your default version.
The install
command is equivalent to the add
command followed by the use
command.
polyn install <version or keyword or prefix>
# Downloading and setting your default to a specific version of Node.js.
polyn install 23.7.0
# Downloading and setting your default to the latest Node.js release that matches a prefix.
polyn install 23
# Downloading and setting your default to the latest Node.js LTS release.
polyn install lts
# Downloading and setting your default to the latest Node.js release.
polyn install latest
polyn current
polyn ls
or
polyn list
polyn rm <version or prefix>
or
polyn remove <version or prefix>
# Deleting a specific version of Node.js.
polyn rm 23.7.0
# Deleting the oldest Node.js release that matches a prefix.
polyn rm 23
polyn version
PolyNode's configuration is handled through a JSON file named polynrc.json
located in PolyNode's home directory ($HOME/.PolyNode
for AIX/Linux/macOS or %LOCALAPPDATA%\Programs\PolyNode
for Windows). Please see below for the default configuration for polynrc.json
:
{
"nodeMirror": "https://nodejs.org/dist"
}
This field is a string
that represents the URL to download Node.js. Default value is "https://nodejs.org/dist"
.
PolyNode does not require sudo/admin privileges to uninstall.
- Run the
$HOME/.PolyNode/uninstall/uninstall
binary.
- Run
%LOCALAPPDATA%\Programs\PolyNode\uninstall\uninstall.exe
.
There are two main ways to build PolyNode from source: Using the bundle scripts or building the Dockerfile.
If you're just testing your build locally, I would recommend building a Docker image from the Dockerfile. The bundle scripts are helpful if you want to install/distribute your own build.
- Go 1.24.1
Run the POSIX shell script ./scripts/aix/bundle
. This script will build PolyNode's source code for Power 64-bit and bundle the artifacts as a .tar.gz file.
Run the POSIX shell script ./scripts/linux/bundle
. This script will build PolyNode's source code for x64, ARM64, Power LE 64-bit, and s390x and bundle the artifacts as separate .tar.xz files.
macOS has a POSIX shell script (./scripts/mac/bundle
) that builds and notarizes PolyNode's source code for x64 and ARM64 and bundles the artifacts as separate .tar.gz files. If you don't need to distribute the binaries, then you don't need the notarization step. Just edit the bundle script and set the sign
variable to 0
.
Run the batchfile .\scripts\win\bundle.cmd
. This batchfile will build PolyNode's source code for x64 and ARM64 and bundle the artifacts as separate .zip files.
- Docker
docker build -t polyn .
All contributions are welcome! If you wish to contribute to the project, the best way would be forking this repo and making a pull request from your fork with all of your suggested changes.
PolyNode draws a lot of inspiration, especially in regards to syntax, from other, more well-known projects, like: nvm, nvm-windows, and nvs.