You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.
Checked that there is not already an Atom package that provides the described functionality: https://atom.io/packages
Description
apm can't detect Visual Studio/Build Tools 2017 or newer.
If a Windows user has a non-usable Visual Studio 2015 or earlier installed (for example, if Visual Studio is installed, but no C++ Build Tools, or no Windows 8/10 SDK is installed), apm will still detect and prefer the non-working, older version.
Steps to Reproduce
Install Visual Studio 2017 or newer with all the required components (such as C++ Build Tools, C++ Core Tools, and a Windows 8 or Windows 10 SDK). This is a usable install of Visual Studio.
Install Visual Studio 2015 or earlier, but don't install C++ Build Tools, or don't install the a Windows 8/10 SDK component. This is a non-usable install of Visual Studio.
Install Atom and apm.
Try to install a package that requires native code to be built. e.g. apm install tree-view.
Expected behavior:
apm install should work using the usable Visual Studio 2017 or 2019 install.
Actual behavior:
apm install fails, with an error about not finding a usable version of Visual Studio, but that other versions would have been valid if set by the flag (this will be "2017" or "2019").
Reproduces how often:
100% of the time, given the conditions laid out in "steps to reproduce" are met.
Versions
C:\Users\[User]>atom-dev --version Atom : 1.50.0-dev-9c16e5c67Electron: 6.1.12Chrome : 76.0.3809.146Node : 12.4.0C:\Users\[User]>apm-dev --versionapm 2.5.0npm 6.14.5node 10.20.1 x64atom 1.50.0-dev-9c16e5c67python 2.7.18git 2.27.0.windows.1visual studio
Happens with apm 2.5.0, or from master branch of this repository. apm has never supported Visual Studio 2017 or 2019, because its hard-coded list of versions to detect only goes up to Visual Studio 2015:
If this version of Visual Studio is missing some required components, node-gyp then rejects that version. Node-gyp fails to find a usable Visual Studio version matching the version set by the --msvs_version flag, and errors out.
Node-gyp itself is better at figuring out whether a Visual Studio version is installed, and whether it has adequate components installed to build native code. So in my view, we should just let node-gyp handle this and not pass the --msvs_version flag at all to node-gyp.
We can still attempt to detect Visual Studio on the disk for the sake of printing it during apm --version. But that is the only reason we should try to detect which version is installed, and the only thing we should use that version number for is printing it during apm --version. Otherwise, for the higher-stakes task of picking a Visual Studio install to build code with, we should let node-gyp do it.
The text was updated successfully, but these errors were encountered:
DeeDeeG
changed the title
apm install fails if a misconfigured (non-usable) Visual Studio 2015 or older is installed, even if a usable Visual Studio 2017 or 2019 is installed
Users with insufficiently configured Visual Studio 2015/older installs are prevented from using a working Visual Studio 2017 or 2019.
Jul 17, 2020
DeeDeeG
changed the title
Users with insufficiently configured Visual Studio 2015/older installs are prevented from using a working Visual Studio 2017 or 2019.
Users with insufficiently configured Visual Studio 2015 (or older) installs are prevented from using a working Visual Studio 2017 or 2019
Jul 17, 2020
Prerequisites
Description
apm
can't detect Visual Studio/Build Tools 2017 or newer.If a Windows user has a non-usable Visual Studio 2015 or earlier installed (for example, if Visual Studio is installed, but no C++ Build Tools, or no Windows 8/10 SDK is installed),
apm
will still detect and prefer the non-working, older version.Steps to Reproduce
apm install tree-view
.Expected behavior:
apm install
should work using the usable Visual Studio 2017 or 2019 install.Actual behavior:
apm install
fails, with an error about not finding a usable version of Visual Studio, but that other versions would have been valid if set by the flag (this will be "2017" or "2019").Reproduces how often:
100% of the time, given the conditions laid out in "steps to reproduce" are met.
Versions
Happens with
apm
2.5.0, or frommaster
branch of this repository.apm
has never supported Visual Studio 2017 or 2019, because its hard-coded list of versions to detect only goes up to Visual Studio 2015:https://github.com/atom/apm/blob/v2.5.0/src/apm.coffee#L82-L91
Additional Information
I have a fix for this, posted at PR #892.
Here's what is happening "under the hood", so to speak:
apm install
specifies--msvs_version
= [some older Visual Studio version such as2015
] when runningnode-gyp
.https://github.com/atom/apm/blob/v2.5.0/src/apm.coffee#L82-L91
If this version of Visual Studio is missing some required components,
node-gyp
then rejects that version. Node-gyp fails to find a usable Visual Studio version matching the version set by the--msvs_version
flag, and errors out.Node-gyp itself is better at figuring out whether a Visual Studio version is installed, and whether it has adequate components installed to build native code. So in my view, we should just let node-gyp handle this and not pass the
--msvs_version
flag at all to node-gyp.We can still attempt to detect Visual Studio on the disk for the sake of printing it during
apm --version
. But that is the only reason we should try to detect which version is installed, and the only thing we should use that version number for is printing it duringapm --version
. Otherwise, for the higher-stakes task of picking a Visual Studio install to build code with, we should let node-gyp do it.The text was updated successfully, but these errors were encountered: