Node-gyp: Project file contains ToolsVersion="14.0". This toolset may be unknown or missing, in which case you may be able to resolve this by installing the appropriate version of MSBuild, or the build may have been forced to a particular ToolsVersion for policy reasons. Treating the project as if it had ToolsVersion="4.0"

Created on 2 Oct 2018  路  4Comments  路  Source: nodejs/node-gyp

  • Node Version: v10.11.0
  • Platform: Windows x64
  • Compiler: msbuild
  • Module: any npm module

Installed the latest VisualStudio 2017 properly and msbuild is bundled in it, but now when I try to build any module that uses node-gyp it fails. Firstly it displays the warning

Building the projects in this solution one at a time.
To enable parallel build, please add the "/m" switch.
Project file contains ToolsVersion="14.0".
This toolset may be unknown or missing,
in which case you may be able to resolve this by installing
the appropriate version of MSBuild, or the build may have been
forced to a particular ToolsVersion for policy reasons.
Treating the project as if it had ToolsVersion="4.0".

and then it fails with the error:

Q:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Cpp.DesignTime.targets(491,5): error MSB4062: The "SetEnv" task could not be loaded from the assembly
Q:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Microsoft.Build.CppTasks.Common.dll. Could not load file or assembly 'Microsoft.Build.Utilities.Core, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

Before installing MSVS2017 everything worked nicely. Also, probably worth mentioning, I installed MSVS on a different drive than my default drive (so not where the windows files are, but on different location).

How to solve this? I guess there are two possibilities why this happens: either node-gyp doesn't support MSVS2017, or node-gyp is unable to properly locate it (while other programs are able to locate it).

Is this a bug with node-gyp? Is there a workaround, or should I uninstall MSVS and install it on the main drive? Thanks.

Most helpful comment

I've had the same issue. I've fixed it like this: npm config set msvs_version 2017

All 4 comments

Could you paste full build log?

> npm install canvas@next --build-from-source>1558-log.txt 2>&1

1558-log.txt

2018-10-03T12_47_27_146Z-debug.log

Here canvas module is used as an example, but it fails with any module that needs building, while it was working before.

Can you try running npm install canvas@next --build-from-source --verbose?

I've had the same issue. I've fixed it like this: npm config set msvs_version 2017

Was this page helpful?
0 / 5 - 0 ratings