12
votes

I'm trying to execute the following command in a Node.js project on Windows 8:

npm install [email protected]

But I'm gettig an error that I have node idea how to deal with.

TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Projects\myproject\node_modules\scrypt\build\copied_files.vcxproj]

Here is the entire output:

[email protected] preinstall C:\Projects\myproject\node_modules\scrypt node node-scrypt-preinstall.js

[email protected] install C:\Projects\myproject\node_modules\scrypt node-gyp rebuild

C:\Projects\myproject\node_modules\scrypt>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-g yp.js" rebuild ) else (node "" rebuild ) Warning: Missing input files: C:\Projects\myproject\node_modules\scrypt\build..\scrypt\win\include\config.h 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. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [C:\Projects\myproject\node_modules\scrypt\build\copied_files.vcxproj] Copying scrypt/win/include/config.h to scrypt/scrypt-1.2.0/config.h The system cannot find the file specified. TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Projects\myproject\node_modules\scrypt\build\copied_files.vcxproj]

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. TargetFrameworkVersion or PlatformToolset may be set to an invalid version number. [C:\Projects\myproject\node_modules\scrypt\build\scrypt_wrapper.vcxproj] TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [C:\Projects\myproject\node_modules\scrypt\build\scrypt_wrapper.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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23) gyp ERR! stack at emitTwo (events.js:126:13) gyp ERR! stack at ChildProcess.emit (events.js:214:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12) gyp ERR! System Windows_NT 6.2.9200 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:\Projects\myproject\node_modules\scrypt gyp ERR! node -v v8.9.1 gyp ERR! node-gyp -v v3.6.2 gyp ERR! not ok npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] install script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\user\AppData\Roaming\npm-cache_logs\2017-11-13T01_31_12_133Z-debug.log

Help!

3
install CL.exe if not and then go to msdn.microsoft.com/en-us/library/kezkeayy.aspx to set the enviroment variableAbid Nawaz

3 Answers

4
votes

This packages seems to be requiring native compiling. You need to install Visual Studio C++ Build Tools for the same. You can download the same from below link

http://landinghub.visualstudio.com/visual-cpp-build-tools

Also after that you need to make sure that CL.exe is available in your path. It would be on a path like C:\Program Files\Microsoft Visual Studio 10.0\VC\ce\bin. This would change based on the version of build tools you have installed.

You will need to make sure to update your Windows PATH environment variable if the setup doesn't do that for you.

Also if npm still fails, you can always try using yarn

yarn add [email protected]
2
votes

ERR! Failed at the [email protected] install script.

The error is caused by the scrypt package because node-gyp is unable to rebuild,

try running cmd as administrator and run npm install [email protected] , if it doesn't work try node-gyp rebuild or reinstall it

if you fix your issue with node-gyp you should have Cl.exe at the right place in the process of installing node-gyp

0
votes

I was on the same boat and most of the answers found online couldn't help (or not 100% workable)with this rebuild error. After trying on several different methods, I found this way works on my machine (Windows 10 Pro). Now, I'm able to install web3 with no issue. (Or other packages related to node-gyp issues, such as "truffle unbox react")

The steps I concluded is as below:

  1. Install NodeJS, Git
  2. Download Windows Visual Studio 2015
  3. Open Visual Studio 2015 and create "new project..."

    • Select "Create new C++ project"
    • You should see a menu that VS requested to install "Common Tools for Visual C++ 2015" and "Windows 8.1 SDK and Universal CRT SDK" (some processes in scrypt required tools from this Windows 8.1 SDK files)
    • Select both and install
  4. Install/link python through npm command

    • npm --add-python-to-path="true" --debug install --global windows-build-tools
  5. Set msvs_version to 2015
    • npm config set msvs_version 2015 --global
  6. Install web3
    • npm install web3

For the reference: My npm version : 5.6.0 My node version: 8.9.4

Hope this would help!