node.js 节点 gyp 错误跟踪器:错误 TRK0005:无法定位:“CL.exe”。该系统找不到指定的文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/33183161/
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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 19:23:38  来源:igfitidea点击:

node gyp error TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified

node.jsnpmnode-gyp

提问by manas

I want to install bcrypt on a windows 10 machine with visual studio community 2015, Python v2.7.3 installed but i get the following error.

我想在装有 Visual Studio Community 2015、Python v2.7.3 的 Windows 10 机器上安装 bcrypt,但出现以下错误。

node version v4.2.1 node-gyp v3.0.3

节点版本 v4.2.1 node-gyp v3.0.3

npm install bcrypt 


C:\Users\ASMIN\Desktop\M2\app>npm install bcrypt
npm WARN package.json [email protected] No description
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No README data

> [email protected] install C:\Users\ASMIN\Desktop\M2\app\node_modules\bcrypt
> node-gyp rebuild




 C:\Users\ASMIN\Desktop\M2\app\node_modules\bcrypt>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\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 find WindowsSDKDir variable from the registry.  TargetFrameworkVersio
    n or PlatformToolset may be set to an invalid version number. [C:\Users\ASMIN\Desktop\M2\app\node_modules\bcrypt\build\bcrypt_lib.vcxproj]
    TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Users\ASMIN\Desktop\M2\app\node_modules\bcrypt\build\bcrypt_lib.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:\Program Files\nodejs\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 10.0.10240
    gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
    gyp ERR! cwd C:\Users\ASMIN\Desktop\M2\app\node_modules\bcrypt
    gyp ERR! node -v v4.2.1
    gyp ERR! node-gyp -v v3.0.3
    gyp ERR! not ok
    npm ERR! Windows_NT 10.0.10240
    npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "bcrypt"
    npm ERR! node v4.2.1
    npm ERR! npm  v2.14.7
    npm ERR! code ELIFECYCLE

    npm ERR! [email protected] install: `node-gyp rebuild`
    npm ERR! Exit status 1
    npm ERR!
    npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
    npm ERR! This is most likely a problem with the bcrypt package,
    npm ERR! not with npm itself.
    npm ERR! Tell the author that this fails on your system:
    npm ERR!     node-gyp rebuild
    npm ERR! You can get their info via:
    npm ERR!     npm owner ls bcrypt
    npm ERR! There is likely additional logging output above.

    npm ERR! Please include the following file with any support request:
    npm ERR!     C:\Users\ASMIN\Desktop\M2\app\npm-debug.log

回答by Raz Omessi

I had the same problem with another module.

我在另一个模块上遇到了同样的问题。

I solved it by:

我通过以下方式解决了它:

  • Install visual studio community 2013
  • Run npm config set msvs_version 2013 --global
  • Run npm install bcrypt
  • 安装 Visual Studio 社区 2013
  • npm config set msvs_version 2013 --global
  • npm install bcrypt

回答by Xin

Easily, I fixed this issue by simply creating C++ project in VS2015.

很容易,我通过在 VS2015 中简单地创建 C++ 项目来解决这个问题。

Basically, when u choose to create a c++ project, VS2015 will ask you to install a certain component, you just let it install. The issue will get fixed. (BTW, I am using VS2015 on Win10)

基本上,当你选择创建一个c++项目时,VS2015会要求你安装某个组件,你就让它安装。问题将得到解决。(顺便说一句,我在 Win10 上使用 VS2015)

回答by Andrea Maruccia

I had a problem installing karma (npm module). I installed Visual c++ from visual studio 2015 install and it worked.

我在安装 karma(npm 模块)时遇到问题。我从 Visual Studio 2015 install 安装了 Visual c++ 并且它工作正常。

回答by user2699548

I had a similar problem while building a typical hello_world.c console application. The reason was that I decided to install VS2015 to "C:\program files (x86)\msvc14", but the installer installed cl.exe to the default "c:\program files (x86)\Microsoft Visual Studio 14.0" path. Which is obviously a serious bug in the setup program.

我在构建典型的 hello_world.c 控制台应用程序时遇到了类似的问题。原因是我决定将 VS2015 安装到“C:\program files (x86)\msvc14”,但是安装程序将 cl.exe 安装到默认的“c:\program files (x86)\Microsoft Visual Studio 14.0”路径。这显然是安装程序中的一个严重错误。

I merged all the content of "Microsoft Visual Studio 14.0" into the "msvc14" directory, and now all works fine.

我将“Microsoft Visual Studio 14.0”的所有内容合并到“msvc14”目录中,现在一切正常。

回答by Jay

Putting this here in case someone has the same issue:

把它放在这里以防有人遇到同样的问题:

I already had the C++ libraries installed.

我已经安装了 C++ 库。

Updating Node worked for me.

更新节点对我有用。

I assume the older version of node just didn't support my VS2017.

我假设旧版本的节点不支持我的 VS2017。

回答by keysl

Just gonna drop this here in case someone needs this to work with VS 2017 and ethereum web3.js. I faced this problem when installing web3.js

如果有人需要它与 VS 2017 和以太坊 web3.js 一起使用,就将它放在这里。我在安装 web3.js 时遇到了这个问题

  1. Update Node.js to 8.11.1
  2. Create a Visual C++ Project in VS 2017, and make sure it built succesfully
  3. Set the config msvs_version

    npm config set msvs_version 2017 --global

  4. then npm install web3 -g --save

  1. 将 Node.js 更新到 8.11.1
  2. 在 VS 2017 中创建一个 Visual C++ 项目,并确保它成功构建
  3. 设置配置 msvs_version

    npm 配置集 msvs_version 2017 --global

  4. 然后 npm install web3 -g --save