I'm trying to execute the following command in a Node.js project on Windows 8:
npm install web3@1.0.0-beta.24
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:
scrypt@6.0.3 preinstall C:\Projects\myproject\node_modules\scrypt node node-scrypt-preinstall.js
scrypt@6.0.3 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 inbanner@1.6.0 No repository field.npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! scrypt@6.0.3 install:
node-gyp rebuild
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the scrypt@6.0.3 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!
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 likeC:\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
The error is caused by the
scrypt
package becausenode-gyp
is unable to rebuild,try running cmd as administrator and run
npm install scrypt@6.0.3
, if it doesn't work trynode-gyp rebuild
or reinstall itif you fix your issue with node-gyp you should have
Cl.exe
at the right place in the process of installingnode-gyp
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:
Open Visual Studio 2015 and create "new project..."
Install/link python through npm command
npm --add-python-to-path="true" --debug install --global windows-build-tools
npm config set msvs_version 2015 --global
npm install web3
For the reference: My npm version : 5.6.0 My node version: 8.9.4
Hope this would help!