Skip to content

Commit 53c99ae

Browse files
authored
Fix reading msvs version on Windows (#2644)
* fix: fix reading msvs version on windows
1 parent b030555 commit 53c99ae

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

lib/configure.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ function configure (gyp, argv, callback) {
8585
'build dir', '"build" dir needed to be created?', isNew ? 'Yes' : 'No'
8686
)
8787
if (win) {
88-
findVisualStudio(release.semver, gyp.opts.msvs_version,
88+
findVisualStudio(release.semver, gyp.opts['msvs-version'],
8989
createConfigFile)
9090
} else {
9191
createPythonSymlink()

lib/node-gyp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ proto.configDefs = {
6060
debug: Boolean, // 'build'
6161
directory: String, // bin
6262
make: String, // 'build'
63-
msvs_version: String, // 'configure'
63+
'msvs-version': String, // 'configure'
6464
ensure: Boolean, // 'install'
6565
solution: String, // 'build' (windows only)
6666
proxy: String, // 'install'

test/test-options.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,13 @@ describe('options', function () {
3838

3939
assert.strictEqual(g.opts['force-process-config'], 'true')
4040
})
41+
42+
it('options with msvs_version', () => {
43+
process.env.npm_config_msvs_version = '2017'
44+
45+
const g = gyp()
46+
g.parseArgv(['rebuild']) // Also sets opts.argv.
47+
48+
assert.strictEqual(g.opts['msvs-version'], '2017')
49+
})
4150
})

0 commit comments

Comments
 (0)