Nvm: Silent Flag Is Not Silent

Created on 19 Jun 2020  Â·  5Comments  Â·  Source: nvm-sh/nvm

Operating system and version: MacOS 10.15.2

nvm debug output:


nvm --version: v0.35.3
$TERM_PROGRAM: Apple_Terminal
$SHELL: /bin/zsh
$SHLVL: 1
${HOME}: /Users/home
${NVM_DIR}: '${HOME}/.nvm'
${PATH}: ${NVM_DIR}/versions/node/v12.18.1/bin:/usr/local/sbin:${HOME}/Downloads/google-cloud-sdk/bin:${HOME}/.yarn/bin:${HOME}/.config/yarn/global/node_modules/.bin:${NVM_DIR}/versions/node/v12.18.1/bin:${HOME}/.rvm/gems/ruby-2.4.0/bin:${HOME}/.rvm/gems/ruby-2.4.0@global/bin:${HOME}/.rvm/rubies/ruby-2.4.0/bin:${NVM_DIR}/versions/node/v14.1.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion.app/Contents/Public:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Wireshark.app/Contents/MacOS:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/usr/local/share/npm/bin:/opt/local/bin:/opt/local/sbin:/opt/local/lib/postgresql92/bin:/opt/nginx/sbin:/opt/local/libexec/gnubin:/web/tools/bin:/web/play-2.0:/web/util-eng/bin:/web/util-gg-grunt/bin:/web/util-avro-tool/bin:${NVM_DIR}/versions/node/v0.12.2/bin:${HOME}/.rvm/bin:${HOME}/bin:/Applications/Kitematic (Beta).app/Contents/Resources/resources:${HOME}/.nexustools:${HOME}/code/contrib/omelette/example:/usr/local/mysql/bin
$PREFIX: ''
${NPM_CONFIG_PREFIX}: ''
$NVM_NODEJS_ORG_MIRROR: ''
$NVM_IOJS_ORG_MIRROR: ''
shell version: 'zsh 5.7.1 (x86_64-apple-darwin19.0)'
uname -a: 'Darwin 19.2.0 Darwin Kernel Version 19.2.0: Sat Nov 9 03:47:04 PST 2019; root:xnu-6153.61.1~20/RELEASE_X86_64 x86_64'
OS version: Mac 10.15.2 19C57
curl: /usr/bin/curl, curl 7.64.1 (x86_64-apple-darwin19.0) libcurl/7.64.1 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.39.2
wget: /usr/local/bin/wget, GNU Wget 1.19.1 built on darwin16.6.0.
sed: /usr/bin/sed
cut: /usr/bin/cut
basename: /usr/bin/basename
rm: /bin/rm
mkdir: /bin/mkdir
xargs: /usr/bin/xargs
git: /usr/bin/git, git version 2.24.3 (Apple Git-128)
ls: grep:: No such file or directory
grep: grep: aliased to grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox} (grep --color=auto --exclude-dir={.bzr,CVS,.git,.hg,.svn,.idea,.tox}), grep (BSD grep) 2.5.1-FreeBSD
awk: /usr/bin/awk, awk version 20070501
nvm current: v12.18.1
which node: ${NVM_DIR}/versions/node/v12.18.1/bin/node
which iojs: iojs not found
which npm: ${NVM_DIR}/versions/node/v12.18.1/bin/npm
npm config get prefix: ${NVM_DIR}/versions/node/v12.18.1
npm root -g: ${NVM_DIR}/versions/node/v12.18.1/lib/node_modules

nvm ls output:


→ nvm ls
         v4.8.4
        v6.14.1
         v8.4.0
        v8.14.0
         v9.2.0
        v10.7.0
       v10.16.0
        v12.3.1
       v12.15.0
       v12.16.2
->     v12.18.1
        v14.1.0
default -> 14 (-> v14.1.0)
node -> stable (-> v14.1.0) (default)
stable -> 14.1 (-> v14.1.0) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/erbium (-> v12.18.1)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.17.0 (-> N/A)
lts/dubnium -> v10.21.0 (-> N/A)
lts/erbium -> v12.18.1

How did you install nvm?

Install Script

What steps did you perform?

Within a directory that contains an .nvmrc file:

nvm use --silent

What happened?

I received the following output in the terminal

Found '/Users/home/code/allergan/loyalty-backend/.nvmrc' with version <12>

What did you expect to happen?

I expected no output, as I was using the --silent flag.

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

Nothing unusual

All 5 comments

This can be resolved by changing this line: https://github.com/nvm-sh/nvm/blob/6575b6b0522e503248d319da9075b58d43b7813b/nvm.sh#L352 to:

  if [ $NVM_USE_SILENT -ne 1 ]; then
    nvm_echo "Found '${NVMRC_PATH}' with version <${NVM_RC_VERSION}>"
  fi

Sounds like a straightforward fix, with tests of course. Are you interested in making a PR?

@ljharb I am stupid strapped for time right now (work + family + myriad oss obligations). The report and presenting the fix was the best I could do right now.

No worries, thanks for your help so far.

I created a PR to resolve this issue. There were other needs to resolve it than that simple two lines of code. Please refer to it here #2279

Was this page helpful?
0 / 5 - 0 ratings