'cmake' is not recognised as an internal or external command

103,989

Solution 1

The error message means it cannot find cmake.
You can add its location to your path from the prompt like this:

set PATH="C:\Program Files (x86)\CMake 2.8\bin\";%PATH%

Solution 2

As @doctorlove mentioned above, the error message means it cannont find Cmake.

Note that quotes aren't needed in PATH environmental variables on Windows. So the above example on Windows would look like:

set PATH=C:\Program Files (x86)\CMake 2.8\bin\;%PATH% 

I had the same issue, and resolved it in this post.

Solution 3

note that if you installed cmake via chocolatey, you may have neglected to add the argument --installargs 'ADD_CMAKE_TO_PATH=System'. If you've already choco-installed cmake without that argument, re-installing via --force won't respect the new argument: you'll need to uninstall and then install. specifically choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System'

Solution 4

I had the same problem since I intalled CMake in D:\Program Files , I fixed it by manually adding a path variable.

  1. Open control panel
  2. Go to System and Security then go to System. How it looks like in after step 2
  3. Here Select advanced System settings, a dialogue box will appear. The dialogue box
  4. Now go to Environment Variables.
  5. Now select path and then click on edit After the 4th Step
  6. Here add a new path at the bottom of many pre existing paths.
  7. In my case i installed CMake in D:\Program Files\
  8. So I need to add path D:\Program Files\CMake\bin. You should copy the path to your CMake folder and add \bin at the end.
  9. Now open you have to restart command prompt to see the changes.

Solution 5

I found the CMake to be:

  C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\Common7\IDE\CommonExtensions\Microsoft\CMake\CMake\bin

I added it to the User PATH as described above, by hrithik singla, and node-gyp worked, specifically "npm install". I expect it will change again in the future. So the way I found it was by having Windows Explorer search "C:\Program Files (x86)\Microsoft Visual Studio\2019" and then dig through the results for the CMake path. Probably, other development tools will install CMake to different folders.

Share:
103,989
Ryan White
Author by

Ryan White

萝卜青菜,各有所爱。 Covets cats chocolate coding chromebooks coffee corgis chinese computers cartoons cycling commas cst

Updated on December 31, 2021

Comments

  • Ryan White
    Ryan White over 2 years

    I'm trying to run cmake in Visual Studio 10, for esys-particle-win.

    My path to cmake:C:\Program Files (x86)\CMake 2.8\bin\cmake.exe

    My path to esys-particle-win:C:\esys-particle-win\trunk\buildvs2010\mkvs10.bat

    The commands I'm typing in the administrator command prompt of Visual Studio 2010 are:

    cd c:\esys-particle-win\trunk\buildvs2010
    mkvs10.bat
    

    and I'm getting this error:

    'cmake' is not recognized as an internal or external command
    

    contents of mkvs10.bat:

    cmake .. -G "Visual Studio 10" -G "NMake Makefiles"
    

    could anyone tell me where I am wrong?. I don't know computer programming. I followed the instructions mentioned in section 2.3.1 of this site: `

    https://launchpadlibrarian.net/139659869/esys-particle-win-%28v2.1%29-build-instructions.pdf

    ` Any help would be greatly appreciated, Thank you.

  • doctorlove
    doctorlove over 10 years
    You said cmake - it looked in the current directory, couldn't find it, so down every directory in the PATH and still couldn't find it so complained. set PATH=whatever sets the PATH to whatever. %PATH% means whatever is currently is, so thais adds the path to cmake to everything else. Watch out - it can only be of limited length.
  • Dave Voyles
    Dave Voyles over 8 years
    Note that quotes aren't needed in PATH environmental variables on Windows. So the above example on Windows would look like: set PATH=C:\Program Files (x86)\CMake 2.8\bin\;%PATH% I had the same issue, and resolved it in this post: stackoverflow.com/questions/32857449/…
  • Jim Fell
    Jim Fell almost 7 years
    If 64-bit, the path is C:\Program Files\CMake\bin. You can also update your PATH variable by going to System Properties (Right-click Computer --> Properties --> Advanced system settings) --> Advanced tab --> Environment Variables... button.
  • Yun
    Yun almost 3 years
    Please include an explanation with your answer. Also, this answer has been given several times already.