node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

The `msvs_version` option doesn't work from `.npmrc` nor from environment variable

Open CMCDragonkai opened this issue 3 years ago • 1 comments

I'm using the latest node-gyp.

I've found that msvs_version doesn't actually work from .npmrc nor from environment variables.

Here's what happens.

  1. If you set $env:npm_config_msvs_version=2019; node-gyp configure, what happens is that the gyp.opts contains msvs-version, but not msvs_version. This leads the configure command to assume that the env variable hasn't been set.
  2. If you set npm config set msvs_version 2019 --location project, it also doesn't work, instead nothing is read at all, the gyp.opts does not contain msvs_version at all.
  3. If you set node-gyp configure --msvs_version=2019 then it does work, and it shows up on gyp.opts.

CMCDragonkai avatar Jul 12 '22 15:07 CMCDragonkai

https://github.com/nodejs/node-gyp/pull/2644

jeremywho avatar Sep 12 '22 20:09 jeremywho

This issue has been stale for a long time. If there are no objections, I will close this issue next Mon-Tue. In case something similar happens again please open a new issue.

In addition, https://github.com/nodejs/node-gyp/pull/2644 addresses it.

StefanStojanovic avatar Apr 18 '24 10:04 StefanStojanovic

Modern versions of npm no longer allow the setting of msvs_version

cclauss avatar Apr 18 '24 15:04 cclauss

So what does that mean if it is no longer allowed to set it? Is it now automatic?

CMCDragonkai avatar Apr 19 '24 04:04 CMCDragonkai

https://github.com/nodejs/node-gyp/blob/main/README.md#on-windows

cclauss avatar Apr 19 '24 06:04 cclauss