CMake: Visual Studio 15 2017 could not find any instance of Visual Studio

前端 未结 5 1618
死守一世寂寞
死守一世寂寞 2020-12-28 11:20

When I am trying to install CMake I get the error:

Visual Studio 15 2017 could not find any instance of Visual Studio.

I am using Windows 7

相关标签:
5条回答
  • 2020-12-28 11:59

    I had the same issue "could not find any instance of Visual Studio" but with Visual Studio 2019 (Community Edition) and I just had to configure the VS160COMNTOOLS variable so that CMake correctly detects Visual Studio.

    export VS160COMNTOOLS="/c/Program Files (x86)/Microsoft Visual Studio/2019/Community/Common7/Tools"
    

    (cf https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html)

    With Visual Studio 15 2017, the variable you need should be VS150COMNTOOLS. (cf https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2015%202017.html)

    NB: in my case, in a Travis-CI workflow, I installed Visual Studio using the commands (no need to reboot):

    choco install visualstudio2019community
    choco install visualstudio2019-workload-nativedesktop # required
    

    With only the first package, CMake detection of VS2019 failed.

    0 讨论(0)
  • 2020-12-28 12:16

    if you have installed two or more Windows 10 SDK, delete them excluding latest one.

    0 讨论(0)
  • 2020-12-28 12:20

    In my case, I installed Visual Studio, selecting the workloads and modules that I wanted, but I ignored the request to reboot, assuming that shutting down the computer at the end of the day and restarting it the following day would suffice. I was wrong.

    The following day I tried a cmake build and got the "could not find any instance of Visual Studio" error. After several attempts to resolve, I re-ran the installer, made no changes to the configuration, and clicked Modify. This time I let it reboot the computer. The reboot took a long time. After which my cmake build worked.

    0 讨论(0)
  • 2020-12-28 12:20

    Try downloading the windows-build-tools package.

    npm install --global --production windows-build-tools --vs2015
    

    This step should be the end-all-be-all solution to fixing node-gyp problems. For most people, that’s true. NPM has a package called windows-build-tools that should automatically install everything you need to get node-gyp working, including the Microsoft build tools, compilers, Python, and everything else required to build native Node modules on Windows.

    0 讨论(0)
  • 2020-12-28 12:21

    I ran into the same error and performed the following steps to resolve the issue:

    1. Open Visual Studio
    2. Go to Tools -> Get Tools and Features
    3. In the "Workloads" tab enable "Desktop development with C++"
    4. Click Modify at the bottom right

    These steps resulted in the "Visual C++ tools for CMake" feature being installed, but the other optional C++ features included in this workload may also helpful for what you are trying to do.

    After the Visual Studio updater finishes installing try re-running the command. You may need to open a new command window.

    0 讨论(0)
提交回复
热议问题