Nvm: Unable to remove the warning re: prefix configuration; installation is successful, but returns nonzero status

Created on 5 Jul 2017  ·  8Comments  ·  Source: nvm-sh/nvm

  • Operating system and version:
Traviss-Mac-8:travis_staging_test travis$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.12.1
BuildVersion:   16B2555

macOS Sierra

  • nvm debug output:

nvm --version: v0.33.2
$SHELL: /bin/bash
$HOME: /Users/travis
$NVM_DIR: '$HOME/.nvm/'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
$NVM_NODEJS_ORG_MIRROR: 'https://nodejs.org/dist'
$NVM_IOJS_ORG_MIRROR: 'https://iojs.org/dist'
shell version: 'GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin16)'
uname -a: 'Darwin 16.1.0 Darwin Kernel Version 16.1.0: Thu Oct 13 21:26:57 PDT 2016; root:xnu-3789.21.3~60/RELEASE_X86_64 x86_64'
OS version: Mac 10.12.1 16B2555
curl: /usr/bin/curl, curl 7.49.1 (x86_64-apple-darwin16.0) libcurl/7.49.1 SecureTransport zlib/1.2.8
wget: /usr/local/bin/wget, GNU Wget 1.18 built on darwin16.0.0.
git: /usr/local/bin/git, git version 2.10.2
nvm current: system
which node: /usr/local/bin/node
which iojs:
which npm: /usr/local/bin/npm
npm config get prefix: /usr/local
npm root -g: /usr/local/lib/node_modules

  • nvm ls output:

        v0.8.28
       v0.10.48
       v0.12.17
        v5.12.0
         v6.9.1
         v8.1.3
->       system
default -> 6 (-> v6.9.1)
node -> stable (-> v8.1.3) (default)
stable -> 8.1 (-> v8.1.3) (default)
iojs -> N/A (default)
lts/* -> lts/boron (-> N/A)
lts/argon -> v4.8.3 (-> N/A)
lts/boron -> v6.11.0 (-> N/A)

  • How did you install nvm? (e.g. install script in readme, homebrew):

On Travis CI.

  • What steps did you perform?

    nvm install 8

  • What happened?

It successfully installs the specified version (8 in the example above), but displays an error message and exits with status 11.

Traviss-Mac-8:travis_staging_test travis$ nvm install 8
Downloading and installing node v8.1.3...
Downloading https://nodejs.org/dist/v8.1.3/node-v8.1.3-darwin-x64.tar.gz...
######################################################################## 100.0%
Computing checksum with shasum -a 256
Checksums matched!
nvm is not compatible with the npm config "prefix" option: currently set to "/Users/travis/.nvm/versions/node/v8.1.3"
Run `npm config delete prefix` or `nvm use --delete-prefix v8.1.3` to unset it.
Traviss-Mac-8:travis_staging_test travis$ echo $?
11

Suggested fixes do not eradicate the warnings.

Traviss-Mac-8:travis_staging_test travis$ npm config delete prefix
Traviss-Mac-8:travis_staging_test travis$ nvm install 8
v8.1.3 is already installed.
nvm is not compatible with the npm config "prefix" option: currently set to "/Users/travis/.nvm/versions/node/v8.1.3"
Run `npm config delete prefix` or `nvm use --delete-prefix v8.1.3` to unset it.
Traviss-Mac-8:travis_staging_test travis$ nvm use --delete-prefix v8.1.3
Now using node v8.1.3 (npm v5.0.3)
Traviss-Mac-8:travis_staging_test travis$ nvm install 8
v8.1.3 is already installed.
nvm is not compatible with the npm config "prefix" option: currently set to "/Users/travis/.nvm/versions/node/v8.1.3"
Run `npm config delete prefix` or `nvm use --delete-prefix v8.1.3` to unset it.
  • What did you expect to happen?

Two things.

  1. The installation succeeds with status 0.
  2. The warning is removed by performing either of the suggested workarounds.

The latter may actually be a red herring, as neither of the suggested workaround is actually doing anything.

  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?

There should be. Here's $PATH.

Traviss-Mac-8:travis_staging_test travis$ echo $PATH
/Users/travis/.rvm/gems/ruby-2.0.0-p648/bin:/Users/travis/.rvm/gems/ruby-2.0.0-p648@global/bin:/Users/travis/.rvm/rubies/ruby-2.0.0-p648/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Users/travis/.rvm/gems/ruby-2.0.0-p648/bin:/Users/travis/.rvm/gems/ruby-2.0.0-p648@global/bin:/Users/travis/.rvm/rubies/ruby-2.0.0-p648/bin:/Users/travis/.rvm/bin:/Users/travis/bin:/Users/travis/.local/bin:/Users/travis/.debug
bugs needs followup

All 8 comments

The nonzero exit status is especially problematic, as it causes https://github.com/travis-ci/travis-ci/issues/8008.

The nonzero exit status is correct there; the real question is why the prefix warning is occurring in the first place.

Prior to nvm install or nvm use, what do all of echo $PREFIX; env | grep -i npm; whoami print out? Do you have any .npmrc files in the filesystem in $PWD all the way up to /?

Traviss-Mac-3:travis_staging_test travis$ echo $PREFIX; env | grep -i npm; whoami

travis

No .npmrc exists.

Traviss-Mac-3:travis_staging_test travis$ dir=$PWD; while [ x$dir != x ]; do ls -l $dir/.npmrc; dir=${dir%/*}; done; ls -l /.npmrc
ls: /Users/travis/build/BanzaiMan/travis_staging_test/.npmrc: No such file or directory
ls: /Users/travis/build/BanzaiMan/.npmrc: No such file or directory
ls: /Users/travis/build/.npmrc: No such file or directory
ls: /Users/travis/.npmrc: No such file or directory
ls: /Users/.npmrc: No such file or directory
ls: /.npmrc: No such file or directory

@ljharb I can coordinate a live VM access for you, if you think that helps. Ping me in Slack.

I'm having the same issue, can't get rid of that warning msg. I have a .npmrc

//registry.npmjs.org/:_authToken=xxxxxxxxx

My .bash_profile:


# git completion
if [ -f ~/.git-completion.bash ]; then
  . ~/.git-completion.bash
fi

# enable terminal colours
export TERM="xterm-color"
#export PS1='\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\]:\[\e[0;34m\]\w\[\e[0m\]\$ '
export PS1='\[\e[0;35m\]\u\[\e[0m\]@\[\e[0;36m\]\h\[\e[0m\]:\[\e[0;33m\]\w\[\e[0m\]\$ '

export LSCOLORS=GxFxCxDxBxegedabagaced
#export PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '

# Tell ls to be colourful
export CLICOLOR=1
export LSCOLORS=Exfxcxdxbxegedabagacad

# turn colors in ls
alias ls='ls -G'

# Tell grep to highlight matches
export GREP_OPTIONS='--color=auto'

# Ignores dupes in the history
export HISTCONTROL=ignoredups
export PATH="/usr/local/sbin:$PATH"
export PATH="/usr/local/bin:$PATH"

export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"  # This loads nvm bash_completion

First install through homebrew, then uninstalled, run the script provided in the original repository.

Fixed by:

rm -rf ~/.nvm

Then,

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.2/install.sh | bash

Certainly homebrew install of nvm is not supported; the formula indicates as such. Glad that fixed it; I think this is a separate issue.

Was this page helpful?
0 / 5 - 0 ratings