Code Monkey home page Code Monkey logo

rtx-nodejs's Introduction

rtx-nodejs Build

Node.js plugin for rtx version manager

Install

After installing rtx, install the plugin by running:

rtx plugin install nodejs

Use

Check rtx readme for instructions on how to install & manage versions of Node.js at a system and project level.

Behind the scenes, rtx-nodejs utilizes node-build to install pre-compiled binaries and compile from source if necessary. You can check its README for additional settings and some troubleshooting.

When compiling a version from source, you are going to need to install all requirements for compiling Node.js (be advised that different versions might require different configurations). That being said, node-build does a great job at handling edge cases and compilations rarely need a deep investigation.

Configuration

node-build already has a handful of settings, in additional to that rtx-nodejs has a few extra configuration variables:

  • RTX_NODEJS_VERBOSE_INSTALL: Enables verbose output for downloading and building. Any value different from empty is treated as enabled.
  • RTX_NODEJS_FORCE_COMPILE: Forces compilation from source instead of preferring pre-compiled binaries
  • RTX_NODEJS_NODEBUILD_HOME: Home for the node-build installation, defaults to $RTX_DATA_DIR/plugins/nodejs/.node-build, you can install it in another place or share it with your system
  • RTX_NODEJS_NODEBUILD: Path to the node-build executable, defaults to $RTX_NODEJS_NODEBUILD_HOME/bin/node-build
  • RTX_NODEJS_CONCURRENCY: How many jobs should be used in compilation. Defaults to half the computer cores
  • NODEJS_ORG_MIRROR: (Legacy) overrides the default mirror used for downloading the distibutions, alternative to the NODE_BUILD_MIRROR_URL node-build env var

Integrity/signature check

In the past rtx-nodejs checked for signatures and integrity by querying live keyservers. node-build, on the other hand, checks integrity by precomputing checksums ahead of time and versioning them together with the instructions for building them, making the process a lot more streamlined.

.nvmrc and .node-version support

rtx uses a .tool-versions file for auto-switching between software versions. To ease migration, you can have it read an existing .nvmrc or .node-version file to find out what version of Node.js should be used.

Running the wrapped node-build command

We provide a command for running the installed node-build command:

rtx nodejs nodebuild --version

node-build advanced variations

node-build has some additional variations aside from the versions listed in rtx ls-remote nodejs (chakracore/graalvm branches and some others). As of now, we weakly support these variations. In the sense that they are available for install and can be used in a .tool-versions file, but we don't list them as installation candidates nor give them full attention.

Some of them will work out of the box, and some will need a bit of investigation to get them built. We are planning in providing better support for these variations in the future.

To list all the available variations run:

rtx nodejs nodebuild --definitions

Note that this command only lists the current node-build definitions. You might want to update the local node-build repository before listing them.

Manually updating node-build definitions

Every new node version needs to have a definition file in the node-build repository. rtx-nodejs already tries to update node-build on every new version installation, but if you want to update node-build manually for some reason we provide a command just for that:

rtx nodejs update-nodebuild

Default npm Packages

rtx-nodejs can automatically install a set of default set of npm package right after installing a Node.js version. To enable this feature, provide a $HOME/.default-npm-packages file that lists one package per line, for example:

lodash
request
express

You can specify a non-default location of this file by setting a RTX_NPM_DEFAULT_PACKAGES_FILE variable.

rtx-nodejs's People

Contributors

augustobmoura avatar stratus3d avatar hashnuke avatar ypid avatar vadave avatar jdx avatar homburg avatar ahawkins avatar burnettk avatar vic avatar mortax avatar jrogov avatar smorimoto avatar dbernheisel avatar m1kep avatar ygxxii avatar gfyoung avatar zuraguerra avatar ybod avatar rstacruz avatar nicocaille avatar nazarhussain avatar msch avatar lukaselmer avatar justin-calleja avatar dnicolson avatar brianvanburken avatar blimmer avatar roman2k avatar rohantalip avatar

Stargazers

Roland Schaer avatar

Watchers

 avatar

Forkers

dfang

rtx-nodejs's Issues

Terminal output scrolls endlessly due to spinner when lots of default-packages are installed

If my terminal-width is wide enough, I get a normal line like this, with a spinner:

rtx [email protected] Installing the following default packages globally: @fsouza/prettierd, a11y, eslint_d, hiper, jsonlint, nativefier, neovim, ngrok, npm, npm-check, npm-merge-driver, npm-package-json-lint, npm-package-json-lint-config-default, pin-cushion, prettier, semver, tern, tldr, vim-language-server, yarn, zx                                                   ⠐ 34s

… but in a more reasonably-sized terminal, that line gets printed over and over:
image

npm shim loops forever

Now that #4 is fixed, I'm facing another with the npm shim, it loops forever:

# which npm
/home/patrick/.local/share/rtx/shims/npm

# RTX_DEBUG=1 npm -v
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
[DEBUG] Files: ~/.tool-versions, ~/.config/rtx/config.toml
Installed Plugins: consul, golang, helm, kubetail, nodejs, packer, python, terraform, terragrunt, vault
[DEBUG] rtx x -- /home/patrick/.local/share/rtx/plugins/nodejs/shims/npm -v
[DEBUG] consul@latest, golang@latest, helm@latest, kubetail@latest, nodejs@system, packer@latest, python@system [email protected] [email protected], terraform@latest, terragrunt@latest, vault@latest
^C
# cat ~/.tool-versions
consul     latest
golang     latest
helm       latest
kubetail   latest
nodejs     system
packer     latest
python     system 3.9 3.10
terraform  latest
terragrunt latest
vault      latest
# cat ~/.config/rtx/config.toml
[settings]
missing_runtime_behavior = "warn"
experimental = true
shims_dir = "/home/patrick/.local/share/rtx/shims"

RTX_DATA_DIR: unbound variable

I'm facing the following error with updated nodejs plugin:

# npm
/home/patrick/.local/share/rtx/plugins/nodejs/shims/npm: line 14: RTX_DATA_DIR: unbound variable

Please note that this is with node system in .tool-versions and the following global configuration:

[settings]
missing_runtime_behavior = "warn"
experimental = true
shims_dir = "/home/patrick/.local/share/rtx/shims"

Originally posted by @pdecat in #1 (comment)

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.