Git Product home page Git Product logo

nunvm's Introduction

nunvm

Nunvm is a rewrite of nvm in nushell. Unlike nvm, nunvm is cross-platform, meaning it can run on windows too.

Installation

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.

Post-installation

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}"
}

Features

  • 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

Cons

  • 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 requires tar for extracting archives
    • on windows, powershell is required for extracting from archives and the mklink tool for creating symlinks
  • On windows, the use subcommand of nunvm requires elevated privileges, because the use command deletes the previous symlink, if any, and that requires elevated privileges. So when using nunvm 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

Usage

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.

NOTE

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.

Author

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.

nunvm's People

Contributors

yakiyo avatar

Stargazers

whysosergious avatar Noah Andrews avatar  avatar  avatar

Watchers

Míla Kuchta avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.