Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR #1429

Closed
mceachen opened this issue Mar 15, 2017 · 6 comments
Labels
pull request wanted This is a great way to contribute! Help us out :-D

Comments

@mceachen
Copy link
Contributor

  • Operating system and version:
Linux i3 4.4.0-66-generic #87-Ubuntu SMP Fri Mar 3 15:29:05 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • nvm debug output:
nvm --version: v0.32.0
$SHELL: /bin/bash
$HOME: /home/mrm
$NVM_DIR: '$HOME/.nvm'
$PREFIX: ''
$NPM_CONFIG_PREFIX: ''
nvm current: v7.7.1
which node: $NVM_DIR/versions/node/v7.7.1/bin/node
which iojs:
which npm: $NVM_DIR/versions/node/v7.7.1/bin/npm
npm config get prefix: $NVM_DIR/versions/node/v7.7.1
npm root -g: $NVM_DIR/versions/node/v7.7.1/lib/node_modules
  • nvm ls output:
$ nvm ls
        v5.12.0
         v6.2.2
         v6.5.0
         v6.8.0
         v7.6.0
->       v7.7.1
default -> node (-> v7.7.1)
node -> stable (-> v7.7.1) (default)
stable -> 7.7 (-> v7.7.1) (default)
iojs -> N/A (default)
lts/* -> lts/argon (-> N/A)
lts/argon -> v4.8.0 (-> N/A)
lts/boron -> v6.10.0 (-> N/A)
  • How did you install nvm?
    install script in readme

  • What steps did you perform?
    Building native npm dependencies

  • What happened?

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
  • What did you expect to happen?
    No warnings

  • Is there anything in any of your profile files (.bashrc, .bash_profile, .zshrc, etc) that modifies the PATH?
    Yes, but that's irrelevant here.

¿por qué no los dos?

I don't know how many other systems look at these variables, so the safest (and most-chicken^H^H^H^H^H^Hconservative) solution would be to set both MIRROR values with and without the NPM prefix. The following, added to my ~/.bashrc after the call to source nvm.sh, removes the node-gyp warning:

export NODEJS_ORG_MIRROR=${NODEJS_ORG_MIRROR-$NVM_NODEJS_ORG_MIRROR}
export IOJS_ORG_MIRROR=${IOJS_ORG_MIRROR-$NVM_IOJS_ORG_MIRROR}

FWIW, I didn't have to unset NVM_NODEJS_ORG_MIRROR. Having both set seems harmless.

@ljharb
Copy link
Member

ljharb commented Mar 15, 2017

Sure, having both set is harmless, and nvm will indeed always set $NVM_NODEJS_ORG_MIRROR for you.

node-gyp is the only software I'm aware of that incorrectly depended on nvm's env vars - it no longer does, hence the warning.

Are you suggesting that nvm add support for $NODEJS_ORG_MIRROR as well? I'm a bit hesitant to add more env var complexity, and to shackle nvm's internal configuration to something other tools depend on (which is why I recommended node-gyp migrate to a separate env var in the first place).

@mceachen
Copy link
Contributor Author

OK. In that case, perhaps the workaround should be:

unset NVM_IOJS_ORG_MIRROR NVM_NODEJS_ORG_MIRROR

I don't know how clever you want to make nvm.sh, but perhaps if node-gyp is a recent-enough version, it could avoid setting the variable in the first place?

@ljharb
Copy link
Member

ljharb commented Mar 15, 2017

I guess a totally reasonable alternative would be, making nvm no longer create these env vars unconditionally - ie, use them if present, fall back to the defaults if not. That should avoid the node-gyp warning in the most scenarios, while also reducing the env var pollution from nvm?

@mceachen
Copy link
Contributor Author

mceachen commented Mar 16, 2017

defaults, fwiw, are super easy, and cross-shell-compatible. You'd just delete this:

# Setup mirror location if not already set
if [ -z "${NVM_NODEJS_ORG_MIRROR-}" ]; then
  export NVM_NODEJS_ORG_MIRROR="https://nodejs.org/dist"
fi

if [ -z "${NVM_IOJS_ORG_MIRROR-}" ]; then
  export NVM_IOJS_ORG_MIRROR="https://iojs.org/dist"
fi

and update nvm_get_mirror with the default URLs:

nvm_get_mirror() {
  case "${1}-${2}" in
    node-std) nvm_echo "${NVM_NODEJS_ORG_MIRROR:-https://nodejs.org/dist}" ;;
    iojs-std) nvm_echo "${NVM_IOJS_ORG_MIRROR:-https://iojs.org/dist}" ;;
    *)
      nvm_err 'unknown type of node.js or io.js release'
      return 1
    ;;
  esac
}

(If this is reasonable I can give you a PR so you can goose your Contributors count)

@ljharb
Copy link
Member

ljharb commented Mar 17, 2017

Thanks, that's totally reasonable, and just what I had in mind :-) Want to submit a PR (with unit test)? :-D

@ljharb ljharb added the pull request wanted This is a great way to contribute! Help us out :-D label Mar 17, 2017
@mceachen
Copy link
Contributor Author

omg hour builds I'm getting monorail flashbacks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pull request wanted This is a great way to contribute! Help us out :-D
Projects
None yet
Development

No branches or pull requests

2 participants