node.js 错误 TRK0005:无法定位:“CL.exe”
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33716369/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
error TRK0005: Failed to locate: "CL.exe"
提问by user994165
I'm using Windows 8.1. I installed Visual Studio 2015 community edition. When I run npm install -g generator-keystone, I get the error at the bottom. I tried running the following commands, but I'm still getting the same results.
我正在使用 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.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:[email protected] [email protected] install: `node-gyp rebuild`
npm WARN install:[email protected] Exit status 1
C:\Users\user\AppData\Roaming\npm
├── [email protected]
└── UNMET PEER DEPENDENCY yo@>=1.0.0
回答by user994165
I went into Visual Studio and created a Visual C++ project, which installed several libraries. npm install worked after that.
我进入 Visual Studio 并创建了一个 Visual C++ 项目,该项目安装了多个库。npm install 在那之后工作。
回答by Yuval A.
I went to \Users\[my-user]\.windows-build-tools- an install file for VS Build-tools was there (for 2017 it's vs_BuildTools.exe), I ran and installed it.
我去了\Users\[my-user]\.windows-build-tools- VS Build-tools的安装文件在那里(2017年是vs_BuildTools.exe),我运行并安装了它。
After that I ran npm install --global --production windows-build-tools("Option 1" from here).
之后我跑了npm install --global --production windows-build-tools(从这里“选项1” )。
Then it worked.
然后它起作用了。
回答by TolisM
I use visual basic 2019 latest version. Couldn't run a project with toolset 140. Insted it pops the message TRK0005: Failed to locate: CL.exe. I change it to 142 and it works.
我使用的是visual basic 2019最新版本。无法使用工具集 140 运行项目。插入它会弹出消息 TRK0005:无法定位:CL.exe。我将其更改为 142 并且它有效。

