Search code examples
node.jsnpmnode-gyp

How to set tarball url of node-gyp via environment variable


I want to use custom node tarball to build node modules via node-gyp, is there any way to set it via environment variable or some config files for node-gyp or npm?


Solution

  • ok, I figure it out now, node-gyp currently doesn't support to set tarball url, but we can set disturl via environment variable or config files.

    in ~/.npmrc, we can add disturl=... to set disturl. also we can set npm_config_disturl as a environment variable and it will be treated as a npm config variable.

    with the disturl, node-gyp will get tarball url