Nunvm is a rewrite of nvm in nushell. Unlike nvm, nunvm is cross-platform, meaning it can run on windows too.
Installation is easy. Just copy the nunvm.nu file and save it in a directory/folder which is added to your system PATH
.
On unix systems (linux/mac), you should name the file as nunvm
(without the extension) and then it can be invoked from the terminal
$ nunvm --version
On windows, create a nunvm.bat
file, with the following content, and add that directory to PATH
nu nunvm.nu
Be sure to use the specific path of nunvm.nu file if it does not exist within the same directory as the bat file.
For using the version of Node installaed by nunvm, you need to see the nunvm current directory to your system path. The path can be viewed by running the following command
$ nunvm path
If you're using bash/zsh, add the following line to your .bashrc
/.zshrc
file:
$ export PATH="$(nunvm path)":$PATH
For powershell, the following can be added to profile.ps1
$Dir = nunvm path
$User = [System.EnvironmentVariableTarget]::User
$Path = [System.Environment]::GetEnvironmentVariable('Path', $User)
if (!(";${Path};".ToLower() -like "*;${Dir};*".ToLower())) {
[System.Environment]::SetEnvironmentVariable('Path', "${Path};${InstallDir}", $User)
$Env:Path += ";${Dir}"
}
- Cross platform, unlike nvm which only works for unix like systems
- Is decently fast
- Some actions are customizable
- Supports reading from
.nvmrc
file in current directory, similar to nvm - All subcommands of nvm like install, uninstall, alias, unalias, list, list-remote are supported
- nunvm symlinks directories for setting active node versions whereas nvm uses shiming
- nunvm requires some tools be preinstalled. This may be solved in the future when nupm becomes stable and it is easier to install third-party modules/scripts that can be used instead of system apps. The required necessities are as follows
- on unix system, it requires the
ln
tool for creating/removing symlinks and requirestar
for extracting archives - on windows, powershell is required for extracting from archives and the
mklink
tool for creating symlinks
- on unix system, it requires the
- On windows, the
use
subcommand of nunvm requires elevated privileges, because theuse
command deletes the previous symlink, if any, and that requires elevated privileges. So when usingnunvm use
, users might need to run the terminal with admin privileges. This issue has been found for windows for now, unsure about linux/mac - nunvm is still not thoroughly tested so bugs may prevail
Using nunvm is similar to nvm.
For installing a version of node, do
$ nunvm install v18.2.1 # install specific version
$ nunvm install --latest # latest version
$ nunvm install --lts # lts version
$ nunv install # install specified version in `./.nvmrc`
For uninstall, do
$ nunvm uninstall v18.1.0
Aliasing and unaliasing can be done with nunvm alias
& nunvm unalias
.
Use nunvm ls
for listing locally installed version and nunvm ls-remote
for listing all available node versions.
Run nunvm use <VERSION>
to set a node version to active. This requires the steps mentioned in post-installation. If version is unspecified, then it tries to use version from ./.nvmrc
. VERSION
must be a locally installed one.
For queries or issues, feel free to open an new issue.
This project was made as a fun project in my free time, and while it works fine as intended, it is not an industry standard tool and no guarantes can be made about it. Using a more trusted tool like nvm or nvm-windows for production grade apps should be prefered.
nunvm © Yakiyo. Authored and maintained by Yakiyo.
Released under MIT License
If you like this project, consider leaving a star ⭐ and sharing it with your friends and colleagues.