npm install error: “The build tools for v120 (Platform Toolset = 'v120') cannot be found”

后端 未结 5 1594
無奈伤痛
無奈伤痛 2021-01-31 20:22

While running an npm install that required a node-gyp rebuild, the following build error was thrown:

MSB8020: The build tools for v120 (Platf

5条回答
  •  醉梦人生
    2021-01-31 20:54

    I'll share this answer since none of the other fixes resolved my issue. I was having the same errors but setting the msvs param:

    npm install --msvs_version=2015

    was not solving the problem. I could see that it was looking in the wrong place for the toolset no matter what I did.

    Long story short I learned that MSBuild is now packaged with Visual Studio and no longer packaged with .NET. Sure enough I had this entry in the PATH variable:

    C:\Windows\Microsoft.NET\Framework\v4.0.30319;
    

    and consequently the wrong (old) version of MSBuild was being called. I removed this entry and added the following path which is relevant for VS2015:

    C:\Program Files (x86)\MSBuild\14.0\Bin\
    

    Problem solved.

提交回复
热议问题