Giter Site home page Giter Site logo

use-node's Introduction

Overview

usage

No need to setup anything, just run the use-node, then you can use the right node version under your shell.

  • Works the same across Windows, macOS, and Linux.
  • No options, no configs, just run use-node under your node project.
  • Auto-detect the standard engines config recursively from all parent folders.
  • Auto-choose the fastest registry to download node.
  • Auto-cache the node binary.
  • Lightweight and fast.
  • Reports every side-effect it makes on the system, such as where the node is installed.

Installation

Go to the release page and download the use-node binary, run the command below to install use-node to your PATH:

use-node -i

On macOS you might need to do below to trust the binary before run it:

xattr -r -d com.apple.quarantine /path/to/use-node

If you have golang installed:

go install github.com/ysmood/use-node@latest

Use it outside node project

If you want to use it without the package.json file, just specify the node version you want:

use-node v19

Shell Setup

If you want to let it setup PATH env on shell startup, on unix like OS add this line to your .bashrc or .zshrc files:

export PATH=$PATH:$(use-node -p v19.8.1)

If you want to run use-node whenever you cd to a directory, add this line to your .bashrc or .zshrc files:

eval "$(use-node -s)"

On Windows, run use-node -p v19.8.1, copy the output directory path and add it to PATH.

How it works

When you run the use-node. It first recognize the engines field in package.json and automatically download or use the best node version from cache. Then it spawns a sub-shell and inject the node path to your PATH, your current stdio will transparently pipe to the sub-shell.

use-node's People

Contributors

ysmood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

use-node's Issues

OSX builds are not signed / refused to run

The OS X binary cannot be run on a Mac laptop running Catalina. It says something about the binary not being signed or secure. Does not allow you to bypass, you can only move the file to the trash.

Trying to get a 200 person team using this utility but no OSX support is a non-starter.

OSX binary not working

I have a directory with a package.json specifying:

"engines": {
  "node": "18.x"
}

I have used the "manual binary approval" process in #2 but when I run use-node I get

git:(main) use-node

panic: improper constraint: <nil>

goroutine 1 [running]:

[github.com/ysmood/use-node/pkg/utils.E(..](http://github.com/ysmood/use-node/pkg/utils.E(..).)

/Users/yad/repos/use-node/pkg/utils/utils.go:5

[github.com/ysmood/use-node/pkg/node.getNodeInfo({0x0](http://github.com/ysmood/use-node/pkg/node.getNodeInfo(%7B0x0)?, 0x20?})

/Users/yad/repos/use-node/pkg/node/node.go:127 +0x2f4

[github.com/ysmood/use-node/pkg/node.GetNodePath({0x13847b8](http://github.com/ysmood/use-node/pkg/node.GetNodePath(%7B0x13847b8)?,
0xc00001c090}, {0x0, 0x0}, {0x1382340?, 0xc00011c280})

/Users/yad/repos/use-node/pkg/node/node.go:22 +0xa5

main.main()

/Users/yad/repos/use-node/main.go:67 +0x26c

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.