PolyNode

module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2024 License: GPL-3.0

README

PolyNode

PolyNode is a CLI tool that helps install and manage multiple versions of Node.js on the same device. It does not require sudo/admin privileges, and is installed on a per-user basis. Works on AIX, Linux, macOS, and Windows.

PolyNode has a GUI that you can use, but it must be installed first. Release assets prefixed with PolyNode-GUI will install the GUI along with the base CLI command, polyn. Read about launching the GUI below.

Table of contents

  1. Supported operating systems and CPU architectures
  2. How to install
    1. AIX
    2. Linux
    3. macOS
    4. Windows
  3. How to use
    1. Launching the GUI
    2. Upgrading PolyNode
    3. Searching for available Node.js versions
    4. Searching for a specific Node.js version
    5. Downloading a new version of Node.js
    6. Setting your default Node.js version
    7. Temporarily setting your Node.js version
      1. AIX, Linux, or macOS
      2. Windows
    8. Downloading and setting your default Node.js to a new version
    9. Printing your current version of Node.js
    10. Printing all downloaded versions of Node.js
    11. Deleting a downloaded version of Node.js
    12. Printing your current version of PolyNode
  4. How to configure
    1. Configuration fields
      1. guiPort
      2. nodeMirror
  5. How to uninstall
    1. AIX, Linux, or macOS
    2. Windows
  6. Building from source
    1. Required technologies
    2. AIX
    3. Linux
    4. macOS
    5. Windows
  7. Contributing
  8. Acknowledgements

Supported operating systems and CPU architectures

  • AIX (Power 64-bit)
  • Linux (x64 and ARM64)
  • macOS (x64 and ARM64)
  • Windows 10 and newer (x64 and ARM64)

How to install PolyNode

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.

For AIX
  1. Navigate to the latest release.
  2. Download the AIX .tar.gz file.
  3. Extract the .tar.gz file and run the setup binary.
For Linux

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.

  1. Navigate to the latest release.
  2. Download the Linux .tar.xz file appropriate for your CPU architecture.
  3. Extract the .tar.xz file and run the setup binary.
For macOS
  1. Navigate to the latest release.
  2. Download the Darwin .tar.gz file appropriate for your CPU architecture.
  3. Extract the .tar.gz file and run the setup binary.
For Windows
  1. Navigate to the latest release.
  2. Download the Windows .zip file appropriate for your CPU architecture.
  3. Extract the .zip file and run setup.exe.

How to use

PolyNode does not require sudo/admin privileges to use the polyn nor the PolyNode command.

Launching the GUI

The GUI does not have the ability to temporarily set your Node.js version.

If you installed PolyNode's GUI, type this command into your terminal:

PolyNode

Upgrading PolyNode to the latest release

polyn upgrade

Searching for available Node.js versions

polyn search

Searching for a specific Node.js version

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.

polyn search <prefix>

Downloading a new version of Node.js

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>

You can also use the lts keyword to download the latest LTS release without providing a specific version.

polyn add lts

The latest keyword will download the latest release of Node.js.

polyn add latest

Setting your default Node.js version

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>

Temporarily setting your Node.js version

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.

Temporarily setting your Node.js on AIX, Linux, or macOS

eval $(polyn temp <version>)

Temporarily setting your Node.js on Windows

Unfortunately, Windows doesn't have a command equivalent to the POSIX eval. You will have to run polyn temp <version> and then copy and paste the command it outputs.

Downloading and setting your default Node.js to a new version

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>

You can also use the lts keyword to download the latest LTS release without providing a specific version.

polyn install lts

The latest keyword will download the latest release of Node.js.

polyn install latest

Printing your current version of Node.js

polyn current

Printing all downloaded versions of Node.js

polyn ls

or

polyn list

Deleting a downloaded version of Node.js

polyn rm <version>

or

polyn remove <version>

Printing your current version of PolyNode

polyn version

How to configure PolyNode

PolyNode's configuration is handled through a JSON file named polynrc.json located in PolyNode's home directory ($HOME/.PolyNode for AIX/Linux/macOS and %LOCALAPPDATA%\Programs\PolyNode for Windows). Please see below for the default configuration for polynrc.json:

{
  "guiPort": 6011,
  "nodeMirror": "https://nodejs.org/dist"
}
Configuration fields
guiPort

This field is an int that represents the port number the GUI binds to when launched. Only change it if you have another process using that port. Default value is 6011.

nodeMirror

This field is a string that represents the URL to download Node.js. Default value is "https://nodejs.org/dist".

How to uninstall PolyNode

PolyNode does not require sudo/admin privileges to uninstall.

AIX, Linux, or macOS
  1. Run the $HOME/.PolyNode/uninstall/uninstall binary.
Windows
  1. Run %LOCALAPPDATA%\Programs\PolyNode\uninstall\uninstall.exe.

Building from source

Required technologies
  • Go 1.23.2
  • Node.js ^18.19.1 or ^20.11.1 or ^22.0.0 (if building GUI)
  • Angular ^18.2.0 (if building GUI)
  • pnpm 9.12.3 (if building GUI)
Building on AIX

Run the POSIX shell script ./scripts/aix/bundle. This script will build PolyNode's source code for Power 64-bit (with and without the GUI), and bundle the artifacts as separate .tar.gz files.

Building on Linux

Run the POSIX shell script ./scripts/linux/bundle. This script will build PolyNode's source code for x64 and ARM64 (with and without the GUI), and bundle the artifacts as separate .tar.xz files.

Building on macOS

macOS has a POSIX shell script (./scripts/mac/bundle) that builds and notarizes PolyNode's source code for x64 and ARM64 (with and without the GUI), 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.

Building on Windows

Run the batchfile .\scripts\win\bundle.cmd. This batchfile will build PolyNode's source code for x64 and ARM64 (with and without the GUI), and bundle the artifacts as separate .zip files.

Contributing

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.

Acknowledgements

PolyNode draws a lot of inspiration, especially in regards to syntax, from other, more well-known projects, like: nvm, nvm-windows, and nvs.

Directories

Path Synopsis
cmd
polyn command
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL