diff --git a/CHANGELOG.md b/CHANGELOG.md index 87d1f8e..1b2729e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - `--cleanup` removes cached version after install ([#818]) -- mention of `--download` in README +- document using `--download` with run/exec/which in README ### Changed diff --git a/README.md b/README.md index 60670d6..0ed9486 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,7 @@ As a result, both `n` itself and all Node.js versions it manages are hosted insi Changing from a previous Node.js installed to a different location may involve a few extra steps. See docs for [changing node location](./docs/changing-node-location.md) for a walk-through example of switching from using Homebrew to using `n` to manage Node.js. You have a problem with multiple versions if after installing node you see the "installed" and "active" locations are different: + ```console % n lts copying : node/20.12.2 @@ -241,11 +242,7 @@ Remove the cache version after installing using `--cleanup`. This is particularl curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s install --cleanup lts -The `--download` option can be used in two ways, to download a version into cache but not make active: - - n --download lts - -or to download a possibly missing version for `n run`, `n exec`, and `n which`: +Normally `n run`, `n exec`, and `n which` will fail if the target version is not already in the cache. You can add `--download` to use the cache if available or download first if required: n --download run 18.3 my-script.js @@ -290,8 +287,8 @@ To change the location to say `$HOME/.n`, add lines like the following to your s export N_PREFIX=$HOME/.n export PATH=$N_PREFIX/bin:$PATH -If you want to store the downloads under a different location, use `N_CACHE_PREFIX`. This does *not* affect the currently active -node version. +If you want to store the downloads under a different location, use `N_CACHE_PREFIX`. This does _not_ affect where the active +node version is installed. `n` defaults to using xz compressed Node.js tarballs for the download if it is likely tar on the system supports xz decompression. You can override the automatic choice by setting an environment variable to zero or non-zero: diff --git a/bin/n b/bin/n index 3b59076..fb686f4 100755 --- a/bin/n +++ b/bin/n @@ -397,7 +397,7 @@ Options: -h, --help Display help information -p, --preserve Preserve npm and npx during install of Node.js -q, --quiet Disable curl output. Disable log messages processing "auto" and "engine" labels. - -d, --download Download if necessary, and don't make active + -d, --download Download if necessary. Used with run/exec/which. --cleanup Remove cached version after install -a, --arch Override system architecture --offline Resolve target version against cached downloads instead of internet lookup