2293 Commits

Author SHA1 Message Date
Jordan Harband
62387b8f92 v0.40.4 v0.40.4 2026-01-29 14:12:03 -08:00
Sy2n0
44e2590cdf [Fix] sanitize NVM_AUTH_HEADER in wget path 2026-01-09 11:30:14 +09:00
Jordan Harband
242d997da5 [actions] add permissions to GHA workflow 2026-01-29 13:08:52 -08:00
Peter Dave Hello
5533699ec5 Improve uninstall error message for missing versions
Include the requested version in the uninstall error output when

the target is not installed.

Add a fast test to lock the behavior.

Close #3767
2026-01-30 00:04:01 +08:00
Jordan Harband
6d761baef8 [Tests] add retry logic 2026-01-27 20:59:30 -08:00
Jordan Harband
973840565e [Tests] add a timeout 2026-01-27 18:09:39 -08:00
Peter Dave Hello
29a652f90f [patch] show system Node.js version in nvm ls
Normalize `nvm_version` output when `nvm_ls` returns "system vX" so alias and .nvmrc resolutions treat system correctly.

Add fast tests for system alias behavior in `nvm ls`, `nvm use`, and `nvm which`.
2026-01-25 18:19:50 +08:00
Jordan Harband
b1dd81097f [actions] add a finisher to lint 2026-01-27 17:29:59 -08:00
Peter Dave Hello
4d98875a3a Migrate GitHub Copilot instructions to AGENTS.md and CLAUDE.md
Move .github/copilot-instructions.md to AGENTS.md, and generalize the
wording, so it will apply to Codex CLI, Cursor, OpenCode, RooCode, and
many other AI coding agents.

Also add CLAUDE.md as a symlink to AGENTS.md so Claude Code reads the
same guidance.

Copilot coding agent now supports AGENTS.md custom instructions, as
more coding agents support it. Migrating from GitHub Copilot's custom
instructions file to AGENTS.md will help developers leverage more and
different coding agents than just GitHub Copilot.

Reference:
- https://agents.md/
- https://github.blog/changelog/2025-08-28-copilot-coding-agent-now-supports-agents-md-custom-instructions/
2025-09-12 00:05:38 +08:00
Jordan Harband
4c3edc5e56 [actions] migrate Travis CI tests to GitHub Actions 2026-01-27 10:31:07 -08:00
Jordan Harband
35212c1346 [Fix] nvm_has_colors: also check if stdout is a terminal 2026-01-27 10:31:07 -08:00
Jordan Harband
d2f93c1c8e [Tests] mock node in nvm_die_on_prefix test 2026-01-26 22:34:24 -08:00
Jordan Harband
f9dbad9832 [Tests] clean up .nvmrc after nvm-exec test 2026-01-26 22:34:07 -08:00
Jordan Harband
c451e7a4c8 [Tests] set $_ before sourcing nvm.sh in fast tests
nvm.sh uses `NVM_SCRIPT_SOURCE="$_"` to detect its source location.
Adding `: nvm.sh` before each source line ensures `$_` is set correctly, preventing breakage when the previous command (e.g., `set -ex`) overwrites it.
2026-01-26 21:41:57 -08:00
Jordan Harband
9ba422e561 [Fix] nvm_strip_path: avoid gawk-specific RT variable for mawk compatibility 2026-01-26 22:33:58 -08:00
Jordan Harband
38ffc713a7 [Fix] nvm_get_default_packages: use portable awk patterns
Replace POSIX `[[:space:]]` character class with `[ \t]` for
mawk compatibility on Ubuntu 16.04.
2026-01-26 16:59:11 -08:00
Jordan Harband
aa1d829102 [Fix] nvm_install_source: explicitly set SHELL=/bin/sh for make
Old Node.js versions have Makefiles with unquoted glob patterns like
`rm -f *.o` that fail in zsh's strict glob mode. By passing
SHELL=/bin/sh to make, we ensure POSIX-compliant shell behavior
regardless of what shell nvm is running in.
2026-01-26 15:07:01 -08:00
Wes Todd
ec8906b284 [Fix] install.sh: do not log when user has requested no profile modifications
[Tests] `install.sh`: add tests for PROFILE=/dev/null profile skip

Verify that when PROFILE="/dev/null" is set:
- The "Profile not found" warning is suppressed
- Profile modification is skipped as expected

Co-authored-by: Wes Todd <wes@wesleytodd.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2019-12-05 19:30:26 -08:00
Shay Molcho
0509776196 [readme] add missing colon
Inserted missing colons in specific parts of the text to maintain consistency with the existing format. This adjustment ensures a uniform writing style, improves readability, and aligns the text structure with the rest of the document.
2025-01-28 08:28:41 +02:00
Bark
01a8749d7f [Fix] nvm exec: Do a version check on nvm-exec
This check would display a message in case the `.nvmrc` version is not installed, and would not alter the output otherwise.
2024-03-06 16:03:10 +02:00
Sylvain Lesage
0fbe3a6776 [readme] add background on io.js 2025-08-20 09:58:31 -04:00
Ulises Gascón
a36448ffcd [security] add security escalation policy 2025-09-15 14:33:37 +02:00
Noritaka Kobayashi
4d364c2e7b [readme] fix typo 2025-10-18 10:28:48 +09:00
Rahul Beniwal
81f13638d7 [Fix] Reject bare LTS codenames in nvm install
Previously, `nvm install Argon` would succeed by matching the LTS name
in the version description (e.g., "v4.9.1 (Latest LTS: Argon)"), but
`nvm uninstall Argon` would fail because "Argon" is not a valid alias or not a valid version.

Changes:
- Added pattern matching check in nvm_remote_version (nvm.sh:785-791)
- Skips check for implicit aliases (node, stable, etc.) to preserve
  existing functionality
- Added unit tests to verify LTS names are rejected while version
  numbers still work
After this fix:
- `nvm install Argon` → fails (use `nvm install lts/argon` instead)
- `nvm install 4` → still works
- `nvm install node` → still works
- `nvm install lts/argon` → still works

This makes install and uninstall behavior consistent.

Fixes #3474.
2025-11-24 21:57:39 +05:30
Jordan Harband
26066c10f4 [Fix] prevent sed errors when pattern contains #
When `.nvmrc` or alias files contained comments (lines with `#`),
the `#` character could end up in the search pattern passed to sed,
causing "unterminated regular expression" errors because `#` is
used as the sed address delimiter.

This commit fixes the issue in two places:
1. `nvm_alias`: Strip comments from alias file contents before
   returning them, and trim trailing whitespace
2. `nvm_ls`: Escape `#` characters in SEARCH_PATTERN so they're
   treated as literal characters in the sed address

Fixes #3761
2026-01-19 22:58:43 -08:00
Padraic Slattery
34d6d5d6fe [actions] update outdated GitHub Actions versions 2026-01-19 17:39:42 +01:00
Jordan Harband
80cc4cdd1b [actions] fix WSL tests: properly handle Debian apt sources issue
The Debian WSL image has stale apt sources pointing to ftp.debian.org
which no longer hosts bullseye-backports. The previous fix ran sed
after the first setup-wsl call, but that call already failed because
additional-packages triggers apt-get update internally.

For wsl_matrix (Debian, Ubuntu):
- Ubuntu: install with additional-packages directly (no apt issue)
- Debian: install without packages first, fix sources.list with sed,
  then run apt-get update/upgrade/install manually with retries
- Exclude Debian and Ubuntu-20.04 --lts since node v24+ has exec
  format errors on WSL1

For wsl_matrix_unofficial (Alpine):
- Remove the Debian-specific fix entirely (Alpine uses apk, not apt)

See https://github.com/Vampire/setup-wsl/issues/76
2026-01-19 22:11:41 -08:00
Jordan Harband
630a01f2e0 [actions] fix workflow permissions; add codeQL 2025-12-03 12:05:43 -08:00
Jordan Harband
b7b7e949aa [Dev Deps] update markdown-link-check, semver 2025-12-03 12:02:29 -08:00
Jordan Harband
e4e34ec7f9 [Dev Deps] update markdown-link-check, semver 2025-11-10 10:07:02 +07:00
Curt J. Sampson
7c82abdbef [Fix] install.sh: Force remote name of cloned repo to be 'origin'
The script assumes that the name of the remote is `origin`, but this
is not the case if the user has set `clone.defaultRemoteName` to
another value in the ~/.gitconfig (or elsewhere in the configuration).
Adding `-o origin` ensures that the remote will be called `origin`
regardless of the `clone.defaultRemoteName` setting.

Per PR #3341:
- The minimum Git version this should work with is v1.7.10. (This is not
  documented in the repo itself; it's just an implicit requirement.)
- The `--origin` option was added to `git clone` in commit 98a4fef3f2 which
  was released in v1.2.5. From the diff of that commit, the `-o` option was
  already available at that time. So this easily satisfies the above.
- A comment in #3341 indicates that `-o` was added in v1.1.0. I've not
  verified this, but we probably don't need to track that down since by the
  above we're already well within requirements.
2025-09-12 18:27:48 +09:00
Jordan Harband
44a3cdb9b8 [actions] temporary fix for WSL issue
See https://github.com/Vampire/setup-wsl/issues/76
2025-09-05 09:20:08 -07:00
Jordan Harband
34ace599a2 [actions] add new github asset domain to harden-runner 2025-09-05 13:19:27 -07:00
Jordan Harband
18e638e42b [Fix] sh lacks -O; thanks shellcheck 2025-09-05 13:19:27 -07:00
copilot-swe-agent[bot]
9602f4f959 [meta] Add comprehensive .github/copilot-instructions.md for better AI code assistance
This comprehensive guide helps GitHub Copilot better understand and navigate the nvm codebase by providing:

- Complete architecture explanation of nvm's POSIX-compliant design across multiple shells
- Detailed mapping of top-level commands to internal functions (install, use, ls, alias, etc.)
- Comprehensive testing infrastructure guide using urchin framework
- Shell environment setup for bash, zsh, dash, sh, and ksh
- CI environment details for GitHub Actions and Travis CI
- shellcheck setup and usage guidelines
- Development best practices for POSIX compliance and multi-shell compatibility
- Windows support via WSL2, Cygwin, and Git Bash
- Complete internal function categorization and debugging techniques

The documentation covers all aspects of the codebase to enable more accurate AI assistance when working with nvm's complex shell script architecture.
2025-07-02 17:12:44 +00:00
Wei Zhang
c3d674f8f9 [readme] update installation by docker to v0.40.3 2025-06-06 17:13:54 +08:00
copilot-swe-agent[bot]
0215ef8203 [actions] Fix Cygwin workflow HOME variable and add debug output
Co-authored-by: ljharb <45469+ljharb@users.noreply.github.com>
2025-07-03 19:43:14 +00:00
Jordan Harband
1aab8b2d5a [meta] update security policy; add IRP 2025-06-23 16:11:48 -07:00
Jordan Harband
977563e97d v0.40.3 v0.40.3 2025-04-23 16:34:31 -07:00
Toni Viemerö
99352a64d2 [Fix] nvm_install_latest_npm: fix node version detection 2025-04-09 08:16:05 +03:00
Jordan Harband
ffec9fec72 v0.40.2
New Stuff
 - `install.sh`: add `$ZDOTDIR` to zsh search (#3458)

Fixes
 - `reinstall-packages`: do not reinstall corepack (#3544)
 - avoid bash-specific syntax (#3499)
 - `install-latest-npm`: npm v11 is out
 - `nvm_install_latest_npm`: avoid unbound variable (#3447)
 - give a more helpful message when `lts` alias is mistakenly used (#3441)
 - `nvm ls`, `nvm alias`, `nvm install`: error when an LTS name is invalid
 - `nvm_normalize_lts`: error when an LTS name is not lowercase (#3417)

Documentation
 - [readme] update link
 - [readme] fix `--no-use` example (#3479)
 - [readme] update copyright notice (#3507)
 - [readme] note zsh-nvm's AUTO_USE option (#2670)
 - [readme] add note about reloading zshrc after editing (#3052)
 - [readme] Update shell profile file install notes (#2241)
 - [readme] add docker tips (#2318)
 - [readme] remove `avn` from readme (#3469)
 - [readme] fnm -> nvm.fish (#2541)

Refactors
 - prefer `case` over if/else chains
 - combine `sed -e` invocations/arguments

Tests
 - `nvm exec`/`nvm run`: add `--silent` tests (#1259)
 - [actions] release test needs git tags
 - migrate `installation_iojs` test suite to GitHub Actions (#3476)
 - Migrate slow test suite from Travis CI (#3470)
 - temporarily skip this failing travis test to unblock progress
 - [actions] TOC: use latest LTS node
 - `install.sh`: clean up `nvm_detect_profile` tests
 - `nvm_detect_profile`: refactor (#3467)
 - run urchin tests on pull requests (#3466)
 - update mocks
 - ensure that unit tests use only mocked LTS names
 - [actions] use `node/install` instead of `node/run`

Meta
 - disable blank issues
 - update issue template
 - add DCO (#3456)
 - Rename .github/ISSUE_TEMPLATE.md to .github/ISSUE_TEMPLATE/ISSUE_TEMPLATE.md (#3454)
v0.40.2
2025-03-11 13:39:40 -07:00
Jordan Harband
df9ac58f8b [Fix] reinstall-packages: do not reinstall corepack
Fixes #3544
2025-03-11 13:16:58 -07:00
Jordan Harband
8dbc22f0e9 [readme] update link 2025-03-11 12:46:19 -07:00
Jordan Harband
5c12680a62 [Dev Deps] update markdown-link-check 2025-03-11 12:43:42 -07:00
Jordan Harband
f0f8ed12f8 [Dev Deps] update semver 2025-02-25 18:39:49 -08:00
Jordan Harband
759f70f196 [Refactor] prefer case over if/else chains 2025-02-04 22:45:35 -08:00
Jordan Harband
06a9179309 [Refactor] combine sed -e invocations/arguments 2025-02-04 15:55:10 -08:00
Jordan Harband
74eb396099 [Dev Deps] update markdown-link-check 2025-02-04 12:37:59 -08:00
Atsushi Yamamoto
9f520c97db [Tests] nvm exec/nvm run: add --silent tests
Co-authored-by: Atsushi Yamamoto <yamaatsushi927@gmail.com>
Co-authored-by: Jordan Harband <ljharb@gmail.com>
2016-10-11 23:43:10 -07:00
Jordan Harband
e5521cfd3c [actions] release test needs git tags 2025-02-04 08:44:48 -08:00