nvm icon indicating copy to clipboard operation
nvm copied to clipboard

use --silent not silent (enough)

Open nathanuphoff opened this issue 8 months ago • 3 comments
trafficstars

Operating system and version:

macOS 15.3.1

nvm debug output:

nvm --version: v0.39.1

nvm ls output:

    iojs-v2.5.0
      v12.22.12
       v14.19.0
       v16.13.2
       v16.14.2
       v16.15.0
        v17.4.0
       v18.12.1
       v18.16.1
        v20.9.0
       v20.10.0
        v21.5.0
        v22.6.0
->     v22.11.0
       v22.12.0
       v22.13.0
       v22.13.1
default -> 22.11.0 (-> v22.11.0)

How did you install nvm?

brew install nvm

What steps did you perform?

  1. ran nvm use --silent from a dir without a .nvmrc file.

What happened?

It outputted

Please see `nvm --help` or https://github.com/nvm-sh/nvm#nvmrc for more information.

What did you expect to happen?

It to output nothing (to be silent)

Is there anything in any of your profile files that modifies the PATH?

Yes not sure how that applies.

nathanuphoff avatar Mar 11 '25 08:03 nathanuphoff

Do note that nvm is unsupported when installed via brew, as the formula informs you.

--silent isn't to suppress all output - you can do that yourself with 2>&1 >/dev/null - it's just to suppress non-error output.

ljharb avatar Mar 11 '25 15:03 ljharb

Got it, I fixed my use case (initialising nvm in a new session) by adding

if [ -f ".nvmrc" ]; then
  nvm use
fi

to my .zshrc, some flag to achieve the same might be nice to have.

nathanuphoff avatar Mar 15 '25 10:03 nathanuphoff

usually one initializes nvm in a new session from the lines the install script puts in - it auto-uses. I suspect if you use the official install script, and not homebrew, you’ll have a better experience.

ljharb avatar Mar 15 '25 14:03 ljharb