错误TRK0005:找不到:" CL.exe"

时间:2015-11-15 04:20:07

标签: node.js visual-studio npm

我使用的是Windows 8.1。我安装了Visual Studio 2015社区版。当我运行npm install -g generator-keystone时,我在底部得到错误。我尝试运行以下命令,但我仍然得到相同的结果。

set GYP_MSVS_VERSION=2015
npm config set msvs_version 2015 --global


C:\Users\user\AppData\Roaming\npm\node_modules\generator-keystone\node_modules\buffertools>if not defined npm_config_no
de_gyp (node "C:\Users\user\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node
-gyp.js" rebuild )  else (node  rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not fi
nd WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid versio
n number. [C:\Users\user\AppData\Roaming\npm\node_modules\generator-keystone\node_modules\buffertools\build\buffertool
s.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Users\user\AppData
\Roaming\npm\node_modules\generator-keystone\node_modules\buffertools\build\buffertools.vcxproj]


gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib
\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\npm
\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\user\AppData\Roaming\npm\node_modules\generator-keystone\node_modules\buffertools
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:buffertools@2.1.3 buffertools@2.1.3 install: `node-gyp rebuild`
npm WARN install:buffertools@2.1.3 Exit status 1
C:\Users\user\AppData\Roaming\npm
├── generator-keystone@0.3.9
└── UNMET PEER DEPENDENCY yo@>=1.0.0

4 个答案:

答案 0 :(得分:63)

我进入Visual Studio并创建了一个Visual C ++项目,该项目安装了几个库。 npm install在那之后工作。

答案 1 :(得分:3)

我去了\Users\[my-user]\.windows-build-tools-那里有VS Build-tools的安装文件(2017年是vs_BuildTools.exe),我运行并安装了它。

此后,我运行了npm install --global --production windows-build-tools (来自here的“选项1”)。

然后它起作用了。

答案 2 :(得分:0)

我使用Visual Basic 2019最新版本。无法使用工具集140运行项目。安装它会弹出消息TRK0005:找不到:CL.exe。我将其更改为142即可使用。

答案 3 :(得分:0)

如果您的项目很旧,请尝试其他平台。在一种情况下,我将Project-> Properties-> Platform Toolset从Windows XP更改为较新的平台,然后选择了Rebuild Solution。