Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[solved] Using Visual C++ Build Tools 2015 – standalone C++ tools #802

Closed
dotnetCarpenter opened this issue Nov 6, 2015 · 78 comments
Closed

Comments

@dotnetCarpenter
Copy link

[EDIT]

Guide

1 Your OS MUST be Windows
2 Check that python is in your path by writting python --version in the console. If not then
2.1 Download python 2.7 (I recommend chocolatey (choco install python2 -y))
3. Are you on Windows 7? Then follow the rest of 3.x
3.1 Check that you have .NET 4.5.1+ installed. If not then
3.2 Download and install .NET 4.5.1 (.NET 4.5.2 will also work just fine)
4 Download Microsoft Visual C++ Build Tools 2015 Technical Preview
4.1 Install the Windows 8.1 SDK if you haven't already. Note; I recently updated to Windows 10 and had to install the Windows 10 SDK before node-gyp would successfully build.
5 Set the npm config variable msvs_version to 2015: npm config -g set msvs_version 2015
6 Do npm i in what-ever project with node-gyp as a dependency without seeing weird error messages 👍

Tested with node 5.0.0+ and npm 3.3.6

thanks to @mousetraps

I happily noticed that MS provides a standalone c++ compiler. I will try to use it with node-gyp (via utf-8-validate) and report my findings here.

http://blogs.msdn.com/b/vcblog/archive/2015/11/02/announcing-visual-c-build-tools-2015-standalone-c-tools-for-build-environments.aspx

@dotnetCarpenter
Copy link
Author

Adding C:\Program Files (x86)\MSBuild\14.0\Bin to my PATH yields no result. Still getting:

MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location o f the component to the system path if it is installed elsewhere.  [C:\Users\dotnet\Projects\firefund-cli\node_modules\utf-8-validate\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `msbuild` 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 6.1.7601
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\dotnet\Projects\firefund-cli\node_modules\utf-8-validate
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
npm WARN install:utf-8-validate [email protected] install: `node-gyp rebuild`
npm WARN install:utf-8-validate Exit status 1

Need to tell node-gyp to use MSBuild.exe

@mousetraps
Copy link
Contributor

@dotnetCarpenter hey, thanks for trying it out! Did you end up getting it working? Is there anything missing from these steps? #629 (comment)

@dotnetCarpenter
Copy link
Author

thx @mousetraps. Unfortunately I'm not sure how to tell node-gyp to use MSBuild.exe.

You comment prompted me to try just compiling a project via npm install.
I've set npm config set msvs_version 2015 --global but didn't set python as python --version already gives me 2.7.10.

I saw that you successfully compiled utf-8-validate so I cloned that repo and did npm i. The result was not very encouraging:
c:\users\dotnet\.node-gyp\5.0.0\include\node\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\dotnet\Projects\playground\utf-8-validate\b uild\validation.vcxproj]

Got .Net 4.5.2 : Release DWORD 5cbf5 (379893)

Entire output:

> [email protected] install C:\Users\dotnet\Projects\playground\utf-8-validate
> node-gyp rebuild


C:\Users\dotnet\Projects\playground\utf-8-validate {git}
{lamb} 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.  TargetFrameworkVersion or Platfo rmToolset may be set to an invalid version number. [C:\Users\dotnet\Projects\playground\utf-8-validate\build\validation.vcxproj]
  validation.cc
c:\users\dotnet\.node-gyp\5.0.0\include\node\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\dotnet\Projects\playground\utf-8-validate\b uild\validation.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: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.1.7601
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\dotnet\Projects\playground\utf-8-validate
gyp ERR! node -v v5.0.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i"
npm ERR! node v5.0.0
npm ERR! npm  v3.3.6
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 utf-8-validate 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 utf-8-validate
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\dotnet\Projects\playground\utf-8-validate\npm-debug.log

@mousetraps
Copy link
Contributor

Did you install the Windows sdk too when installing the build tools (this should be the default)? I believe that's where winsock2.h comes from.

@dotnetCarpenter
Copy link
Author

I get a similar errors when building ws.

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 Platfo rmToolset may be set to an invalid version number. [C:\Users\dotnet\Projects\playground\ws\node_modules\bufferutil\build\bufferutil.vcxproj]
  bufferutil.cc
c:\users\dotnet\.node-gyp\5.0.0\include\node\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\dotnet\Projects\playground\ws\node_modules\ bufferutil\build\bufferutil.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:270:23)
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 Platfo rmToolset may be set to an invalid version number. [C:\Users\dotnet\Projects\playground\ws\node_modules\utf-8-validate\build\validation.vcxproj]
  validation.cc
c:\users\dotnet\.node-gyp\5.0.0\include\node\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No such file or directory [C:\Users\dotnet\Projects\playground\ws\node_modules\ utf-8-validate\build\validation.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:270:23)

@mousetraps
Copy link
Contributor

@dotnetCarpenter Even after installing the Windows sdk?

@dotnetCarpenter
Copy link
Author

Should I install the Windows 8.1 SDK with the Build Tools installer or the Windows 7 SDK when I'm on Windows 7?

Unfortunately I can not update to Windows 10 due to an unknown installation error when upgrading.

@dotnetCarpenter
Copy link
Author

Hmm.. I somehow thought I could get things compiling without a Windows SDK but in the end I installed Windows 8.1 SDK via the installer and things seems to be working. 🎉

OS: Windows7
Node: 5.0.0
Npm: 3.3.6

@dotnetCarpenter dotnetCarpenter changed the title Using Visual C++ Build Tools 2015 – standalone C++ tools [solved] Using Visual C++ Build Tools 2015 – standalone C++ tools Nov 12, 2015
@rickmed
Copy link

rickmed commented Nov 15, 2015

@dotnetCarpenter
Hi. Installed the Build Tools 2015 provided by @mousetraps, followed instructions, tried to install selenium-webdriver (node-gyp dependant) and got the error below. Any ideas? (nodejs 4.2.2, npm 3.4, windows 10x64)
Thank you!

C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Users\rickm\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\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate\build\validat
ion.vcxproj]
validation.cc
c:\users\rickm.node-gyp\4.2.2\include\node\uv-win.h(32): fatal error C1083: Cannot open include file: 'winsock2.h': No
such file or directory [C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate
\build\validation.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\rickm\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 10.0.10240
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\rickm\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\rickm\AppData\Roaming\npm\node_modules\selenium-webdriver\node_modules\utf-8-validate
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

@dotnetCarpenter
Copy link
Author

warning MSB8003: Could not find WindowsSDKDir variable from the registry.

Looks like you're missing the Windows 10 SDK, since you are on Windows 10. I think you can uninstall Windows SDK 8.1. Let me know if it works and I'll update the guide to be more clear.

Also, be sure to:
3.1 Check that you have .NET 4.5.1+ installed. If not then
3.2 Download and install .NET 4.5.1 (.NET 4.5.2 will also work just fine)

@rickmed
Copy link

rickmed commented Nov 15, 2015

I have installed the windows 10 SDKs but somehow I think it failed to add it to the registry (or something like that), but I don't know how to fix it...

@dotnetCarpenter
Copy link
Author

Run the VisualCppBuildTools_Full.exe that you downloaded from https://www.microsoft.com/en-us/download/details.aspx?id=49512 and choose Repair.

@rickmed
Copy link

rickmed commented Nov 19, 2015

@dotnetCarpenter I finally got it working checking BOTH windows 10 SDKs and windows 8 SDK (I'm on win10) when installing the 2015 build tools. It seems that somehow the windows 10 SDKs is built on top of the windows 8 SDKs OR the windows 10 SDKs package has a bug that fails to add the correspondent registry values, and my system is simple using the windows 8 SDKs (when I added it later).

@dotnetCarpenter
Copy link
Author

sounds weird. perhaps @mousetraps has an idea to why.

@LittleBrainz
Copy link

@dotnetCarpenter - I followed your Guide above with a clean install of Windows 10. The only correction I would make is that, while the Windows 8.1 SDK must be installed, the Windows 10 SDK is completely unnecessary (at least for the purpose of this issue).

@dotnetCarpenter
Copy link
Author

@LittleBrainz thanks. I will update the guide.
@mousetraps I noticed that the link to Microsoft Visual C++ Build Tools 2015 Technical Preview doesn't work anymore. Is the correct link now Microsoft Build Tools 2015 ?

@dotnetCarpenter
Copy link
Author

@mousetraps I can't find the link to Microsoft Visual C++ Build Tools 2015. It seems that you're out of Technical Preview but there is no updates on the C++ blog

@HoriLiu
Copy link

HoriLiu commented Dec 2, 2015

@dotnetCarpenter Link was fixed on the C++ blog:
Download Visual C++ Build Tools 2015

@dotnetCarpenter
Copy link
Author

@HoriLiu thanks! updated

@dotnetCarpenter
Copy link
Author

Apparently, it doesn't matter what OS you're on. You just need the Windows 8.1 SDK.

@mousetraps I suspect that the Windows SDK prerequisite, is node add-on dependent. So if add-on A uses some feature of Windows 10 SDK, then we must install the Windows 10 SDK, correct?

@mousetraps
Copy link
Contributor

I haven't submitted the PR for this yet because I need to confirm something w/ the cpp team (and also update the link and verify Express for Desktop steps), but committed minimal required steps to this branch.
master...mousetraps:i629

It shouldn't be necessary to check the Windows SDK boxes - as explained in #629 (comment), if you select the default install, a minimal set of dependencies from both the Windows 8.1 and Windows 10 SDK will be installed (and yeah, it's confusing because neither box gets checked). We're still working out a few kinks w/ custom install, though.

Any chance you could try those steps, and let us know if you run into any issues?

@dotnetCarpenter
Copy link
Author

What confused me about the installation steps is actually from the c++ blog images, where Windows 8.1 SDK is ticked and your initial comment was not specific about the SDKs. I honestly don't remember if I choose the default installation the first time around but I will try later and update the guide if it works.

@mousetraps
Copy link
Contributor

Well ticking the sdk box should (theoretically) work fine too... and it actually works fine on my machine and several VM configs I've tested (haven't been able to reproduce the other issues ppl are running into yet), but unfortunately we can't ship my machine - partly because it wouldn't scale, and partly because it got stolen today... 😞

In any case, that's the reason we call it "preview" 😃, so we appreciate the feedback and hopefully we can work it all into the RTM release!

@mrparkers
Copy link

I've been trying to get my Windows 7 development environment set up for a while now and nothing I try seems to be working.

Steps I took:

  1. Installed [email protected] (x86).
$ node -v
v4.2.3
  1. Updated to [email protected]
$ npm -v
3.2.2
  1. Installed [email protected] (x86)
$ python --version
Python 2.7.10
  1. Installed .NET Framework 4.5.1 from here
  2. Installed VC++ Build Tools 2015 from here with the default options
  3. Ran required npm configurations
$ npm config set python python2.7
$ npm config set msvs_version 2015 --global

Results:

$ npm install bufferutil

> [email protected] install C:\Users\mp86743\Documents\Dev\test\node_modules\bufferutil
> node-gyp rebuild


C:\Users\mp86743\Documents\Dev\test\node_modules\bufferutil>if not defined npm_config_node_gyp (node "C:\Users\mp86743\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node  rebuild )
gyp: C:\Users\mp86743\.node-gyp\4.2.3\common.gypi not found (cwd: C:\Users\mp86743\Documents\Dev\test\node_modules\bufferutil) while reading includes of binding.gyp while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\mp86743\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:357:16)
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.1.7601
gyp ERR! command "C:\\bench\\nodejs\\4.2.3\\node.exe" "C:\\Users\\mp86743\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\mp86743\Documents\Dev\test\node_modules\bufferutil
gyp ERR! node -v v4.2.3
gyp ERR! node-gyp -v v2.0.2
gyp ERR! not ok
npm WARN EPACKAGEJSON [email protected] No description
npm WARN EPACKAGEJSON [email protected] No repository field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\bench\\nodejs\\4.2.3\\node.exe" "C:\\Users\\mp86743\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "bufferutil"
npm ERR! node v4.2.3
npm ERR! npm  v3.2.2
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 bufferutil 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 bufferutil
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\mp86743\Documents\Dev\test\npm-debug.log

Anyone have any ideas?

@dotnetCarpenter
Copy link
Author

I'm pretty sure that you need to install Windows 8.1 SDK. I think I had the same issue as you. According to @mousetraps the installer is trying to be smart and only install the bare minimum. But it seems that no one has gotten it to work without the Windows 8.1 SDK. Note that no one here have had to install the Windows 10 SDK...

@mrparkers
Copy link

Hi @dotnetCarpenter, thanks for the quick response. I thought that the Windows 8.1 SDK was included with the VC++ Build Tools, which is why I did not install it earlier.

In any case, I installed it from here, and it finished almost instantly, which leads me to believe that I already had it installed. I attempted an npm install bufferutil again with the same results as before.

@bnoordhuis
Copy link
Member

gyp: C:\Users\mp86743.node-gyp\4.2.3\common.gypi

@mrparkers Try deleting the .node-gyp directory, then run npm install again.

@mrparkers
Copy link

@bnoordhuis After doing that, I started getting a different error: 404 status code downloading 32-bit node.lib. I went to this issue thread to see if I could fix that one, which advised me to run npm install node-gyp@latest from C:\Users\mp86743\AppData\Roaming\npm\node_modules\npm, and now I'm running into a different error: Cannot open include file: 'stddef.h', which brought me back to this issue thread, which is the thread that brought me here.

I feel like I'm taking one step forward and two steps back with every attempt at solving my problem 😢

@bnoordhuis
Copy link
Member

The stddef.h error means you're moving in the right direction. You probably need to install VS if you haven't already (see the node-gyp README for details) and run vcvarsall.bat to configure the environment.

@treh1966
Copy link

@dotnetCarpenter
that didnt work either, getting lots og errors ( onvarious local directories and the url like:
...
npm ERR! git clone --template=D:\Benutzer\Administrator\AppData\Roaming\npm-cach
e_git-remotes_templates --mirror https://github.com/tojocky/node-printer.git D
:\Benutzer\Administrator\AppData\Roaming\npm-cache_git-remotes\git-https-github
-com-tojocky-node-printer-git-9b5ed545: undefined
npm ERR! git clone --template=D:\Benutzer\Administrator\AppData\Roaming\npm-cach
e_git-remotes_templates --mirror https://github.com/tojocky/node-printer.git D
:\Benutzer\Administrator\AppData\Roaming\npm-cache_git-remotes\git-https-github
-com-tojocky-node-printer-git-9b5ed545: undefined
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files\nodejs\node.exe" "D:\Benutzer\Administrator
\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "--save"
"https://github.com/tojocky/node-printer.git"
npm ERR! node v4.2.6
npm ERR! npm v3.7.1
npm ERR! code ENOGIT

npm ERR! not found: git
....

So what i did is download the whole master branch to a local directory and point npm to that directory.
Now no matter which version of msvs i specify ( which worked great with nw-gyp) i get the missing header files errors ( stddef.h etc )

Do i have to have a clean npm install of the original to do a nw-gyp rebuild ??

BTW i found a precompiles windows version, but dont know, and found no clues how to use the directory structure, which contains the .node files ?

Thanks in advance
Thomas

@dotnetCarpenter
Copy link
Author

@treh1966 You don't have git installed.

npm ERR! code ENOGIT
npm ERR! not found: git'

You probably need git to install from a local git repository.

What happens when you do a standard install? npm install printer

I can see on the appveyor.com build log that node-printer compiles successfully with MSBuild 12.0, which I'm pretty sure comes with Visual Studio 2013.

Please check your PATH and that node-printer compiles with Visual Studio 2015.

2 Check that python is in your path by writting python --version in the console.

@heroselohim
Copy link

Thanks @dotnetCarpenter and @mousetraps !! Installing the missing Windows 8.1 SDK did make it work.

@Almusamim
Copy link

Installed both Windows 8.1 SDK and win 10 SDK... followed all the instructions and still not working

Hadi@ThinkPad MINGW64 ~/Desktop/New folder/utf-8-validate (master)
$ npm i
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher                            to avoid a RegExp DoS issue
npm WARN deprecated jade@0.26.3: Jade has been renamed to pug, please install th                           e latest version of pug instead of jade
npm WARN deprecated to-iso-string@0.0.2: to-iso-string has been deprecated, use                            @segment/to-iso-string instead.
npm WARN deprecated minimatch@0.3.0: Please update to minimatch 3.0.2 or higher                            to avoid a RegExp DoS issue

> utf-8-validate@1.2.1 install C:\Users\Hadi\Desktop\New folder\utf-8-validate
> node-gyp rebuild


C:\Users\Hadi\Desktop\New folder\utf-8-validate>if not defined npm_config_node_g                           yp (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.
  validation.cc
  win_delay_load_hook.c
C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\src\win_delay_loa                           d_hook.c(34): error C2373: '__pfnDliNotifyHook2': redefinition; different type m                           odifiers [C:\Users\Hadi\Desktop\New folder\utf-8-validate\build\validation.vcxpr                           oj]
  C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\delayimp.h(134)                           : note: see declaration of '__pfnDliNotifyHook2'
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` fail                           ed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\                           npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_proces                           s.js:204:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodej                           s\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Hadi\Desktop\New folder\utf-8-validate
gyp ERR! node -v v6.3.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\                           node_modules\\npm\\bin\\npm-cli.js" "i"
npm ERR! node v6.3.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE
npm ERR! utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the utf-8-validate@1.2.1 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the utf-8-validate packag                           e,
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 information on how to open an issue for this project with:
npm ERR!     npm bugs utf-8-validate
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls utf-8-validate
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Hadi\Desktop\New folder\utf-8-validate\npm-debug.log

@rvagg
Copy link
Member

rvagg commented Jul 15, 2016

@Almusamim you're running in to our __pfnDliNotifyHook2 problem which has been covered pretty extensively on this issue tracker (not that I'm suggesting it's easy to identify!). In order to use the latest release of Visual Studio 2015 you need to get the latest version of node-gyp which comes with the latest v2 and v3 releases of npm. You should be able to run npm i npm@latest -g to get the latest version. Our next v6 release of Node.js should come with this too.

@sorcererstone
Copy link

@ dotnetCarpenter

I am new to node js. I am running into the node-gyp errors this article described. My OS is Win8.1 and I have followed all the instructions but Step6/ in your guide at the beginning.
Can you explain what do you mean by "Do npm i in what-ever project with node-gyp as a dependency without seeing weird error messages"?

For example, currently, after I have performed your step 1-5, I used this command, "npm install -g TheApp". How do I incorporate your step 6 into this install command?

BTW, I have errors related to kerberos when I used the above generic install command which then led to the same node-gyp errors shown in this article.
Also, I did not install node-gyp separately, the app I tried to install w/o success seemed to install this module.
When I look at the user/appdata/roaming folder, node-gyp is created in a separate .node-gyp folder and not within the subfolder of npm/modules folders inside roaming. Is that (strange location of .node-gyp folder) normal?
Should I install node-gyp module (globally) to eradicate these errors?

Please advise.

Thanks in advance,
Sorcerer

@saper
Copy link
Contributor

saper commented Aug 3, 2017

Step 6 means everything is done and there should be no errors. If you are getting something else I'd file another bug. Kerberos errors suggest you might need proxy authentication to download stuff, I think this is out of scope of node-gyp

@WillingAC
Copy link

WillingAC commented Oct 20, 2017

Thank you all for paticipating the discussion and share your insights.
I also met the problem while installing a native node module, and eventually, just solved it by installing Visual C++ Build Tool from npm-gyp official documents Microsoft's Node.js Guidelines for Windows, by which installed

  • Windows 8.1 SDK
    (althought I'm using Windows 10, an error message indicated the missing of 8.1 SDK )
  • .NET Framework SDK.

I also installed the other two, but I'm not sure if they were neccessary, which are

  • Windows 10 SDK
  • ATL/MFC SDK.

With other issues like Python version and PATH settings addressed, npm started to work normally.

@toyssamurai
Copy link

Just like WillingAC, I also followed the official document from Microsoft's Node.js Guidelines for Windows, but I am still having problems when I tried to compile the Couchbase SDK for node (couchnode). The errors I ran into are:

uv-plugin-all.obj : error LNK2001: unresolved external symbol __imp_WSAGetLastError [D:\Development\NodeJs\couchbase-te st\node_modules\couchbase\build\couchbase_impl.vcxproj] uv-plugin-all.obj : error LNK2001: unresolved external symbol __imp_getsockopt [D:\Development\NodeJs\couchbase-test\no de_modules\couchbase\build\couchbase_impl.vcxproj] uv-plugin-all.obj : error LNK2001: unresolved external symbol __imp_recv [D:\Development\NodeJs\couchbase-test\node_mod ules\couchbase\build\couchbase_impl.vcxproj] D:\Development\NodeJs\couchbase-test\node_modules\couchbase\build\Release\couchbase_impl.node : fatal error LNK1120: 3 unresolved externals [D:\Development\NodeJs\couchbase-test\node_modules\couchbase\build\couchbase_impl.vcxproj]

After some Google searches, I found that I needed to link to WS2_32.Lib. I checked the SDK folder under C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x86 (and x64) and the file is there. So, somehow npm-gyp just couldn't pass the location to msbuild. I also tried setting an environment variable ILink_LibraryPath and pointed it to WS2_32.Lib before compiling the module, but it didn't help. I am at lost!

@bnoordhuis
Copy link
Member

@toyssamurai You should report that to the maintainers of the couchbase module, it's not a node-gyp issue. Make sure you're using the latest version, it might have been fixed already.

@tensa008
Copy link

tensa008 commented Jun 4, 2018

I tired to find the MS standalone compiler, but when I opened the link it says the account expired. Is there any other link to download MS C++ standalone compiler.

@refack
Copy link
Contributor

refack commented Apr 9, 2019

In VS2017 & VS2019 MS did not release a stand alone compiler. There is a CLI only "Built Tools" SKU at - https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16

@refack refack closed this as completed Apr 9, 2019
@pancake77j
Copy link

I did all the tasks described above to recompile node-java, in order to install node-jdbc. But I sill fail, even though I did all the described measures above: installed python, have .Net 4.5.1, installed Visual Studio 2015, installed Build Tools, set "npm config -g set msvs_version 2015" and also tried many other measures described in other threads.
But, when I try to recompile node-java, I get the following error message:

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:\EigeneProgramme\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:223:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\EigeneProgramme\nodejs\node.exe" "C:\EigeneProgramme\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Workspaces\Lehre\WE2\node-jdbc-example-master\node_modules\jdbc\node_modules\java
gyp ERR! node -v v12.14.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
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:

Has anybody an idea, what else I can do? Thanks for your help in advance!
John

@bharathrajitagi
Copy link

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\bhara\AppData\Roaming\nvm\v8.12.0\node_modules\npm\node_modules\node-gyp\lib\build.js:262: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 10.0.19042
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 D:\boilerplate\node_modules\zerorpc\node_modules\zeromq
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
error Command failed with exit code 1.

                command='C:\Program Files\nodejs\node.exe' 'C:\Users\bhara\AppData\Roaming\npm\node_modules\yarn\bin\yarn.js' run install
                workingDir=D:\boilerplate\node_modules\zerorpc\node_modules\zeromq

error Command failed with exit code 1.

Anyone have any idea how to resolve this ?

@cclauss
Copy link
Contributor

cclauss commented Oct 5, 2021

@bharathrajitagi The text at https://github.com/nodejs/node-gyp/issues/new has the answers.

You are using node-gyp v3 when the current release is v8. https://github.com/nodejs/node-gyp/releases

@nodejs nodejs locked as resolved and limited conversation to collaborators Oct 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests