brianc / node-libpq

Simple, low level native bindings to PostgreSQL's libpq from node.js
112 stars 42 forks source link

Fails to build/install with Visual Studio 2015 #45

Closed vitaly-t closed 8 years ago

vitaly-t commented 8 years ago

(see the update below)

I don't know why, but I no longer can install this module. Presumably, something has changed on my Windows PC, but I cannot understand what.

Any help, please!

Complete output:

D:\NodeJS\tests>npm install libpq

> libpq@1.8.4 install D:\NodeJS\tests\node_modules\libpq
> node-gyp rebuild

D:\NodeJS\tests\node_modules\libpq>if not defined npm_config_node_gyp (node "C:\Users\Vitaly\AppData\Roaming\nvm\v6.3.0\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.
  connection.cc
  connect-async-worker.cc
  addon.cc
d:\nodejs\tests\node_modules\libpq\src\addon.h(26): warning C4005: 'THIS': macro redefinition (compiling source file ..\src\addon.cc) [D:\NodeJS\tests\node_modules\libpq\build\addon.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(195): note: see previous definition of 'THIS' (compiling source file ..\src\addon.cc)
d:\nodejs\tests\node_modules\libpq\src\addon.h(26): warning C4005: 'THIS': macro redefinition (compiling source file ..\src\connection.cc) [D:\NodeJS\tests\node_modules\libpq\build\addon.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(195): note: see previous definition of 'THIS' (compiling source file ..\src\connection.cc)
d:\nodejs\tests\node_modules\libpq\src\addon.h(26): warning C4005: 'THIS': macro redefinition (compiling source file ..\src\connect-async-worker.cc) [D:\NodeJS\tests\node_modules\libpq\build\addon.vcxproj]
  C:\Program Files (x86)\Windows Kits\8.1\Include\um\combaseapi.h(195): note: see previous definition of 'THIS' (compiling source file ..\src\connect-async-worker.cc)
..\src\connection.cc(584): warning C4267: 'initializing': conversion from 'size_t' to 'int', possible loss of data [D:\NodeJS\tests\node_modules\libpq\build\addon.vcxproj]
  win_delay_load_hook.c
C:\Users\Vitaly\AppData\Roaming\nvm\v6.3.0\node_modules\npm\node_modules\node-gyp\src\win_delay_load_hook.c(34): error C2373: '__pfnDliNotifyHook2': redefinition; different type modifiers [D:\NodeJS\tests\node_modules\libpq\
build\addon.vcxproj]
  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` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Users\Vitaly\AppData\Roaming\nvm\v6.3.0\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_process.js:204:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Vitaly\\AppData\\Roaming\\nvm\\v6.3.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\NodeJS\tests\node_modules\libpq
gyp ERR! node -v v6.3.0
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm WARN tests@1.0.0 No description
npm WARN tests@1.0.0 No repository field.
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" "install" "libpq"
npm ERR! node v6.3.0
npm ERR! npm  v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! libpq@1.8.4 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the libpq@1.8.4 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 libpq 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 information on how to open an issue for this project with:
npm ERR!     npm bugs libpq
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls libpq
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\NodeJS\tests\npm-debug.log
vitaly-t commented 8 years ago

@brianc

I have found the problem. This library fails to build using Visual Studio 2015, but it builds successfully with Visual Studio 2013.

So I had to run the following command in order to make this library compile again:

npm config set msvs_version 2013 --global

This is, of course, a temporary solution, and the problem with VS2015 should be fixed.

brianc commented 8 years ago

I don't support windows myself - if someone wants to contribute a fix to get this building with VS2015 I'm happy to merge it in!

On Tue, Jul 19, 2016 at 1:09 PM, Vitaly Tomilov notifications@github.com wrote:

@brianc https://github.com/brianc

I have found the problem. This library fails to build using Visual Studio 2015, but it builds successfully with Visual Studio 2013.

So I has to run the following command in order to make this library compile again:

npm config set msvs_version 2013 --global

This is, of course, a temporary solution, and the problem with VS2015 should be fixed.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/brianc/node-libpq/issues/45#issuecomment-233717795, or mute the thread https://github.com/notifications/unsubscribe-auth/AADDoZ5nfpztmtUGuOXNT86PIVGF42vDks5qXRLXgaJpZM4JP5Kd .

vitaly-t commented 8 years ago

@brianc just so, I am using VS2015 Community, which is free to use both on Windows and Linux: https://code.visualstudio.com/download

So if you decide to fix it, you can easily install it on Linux and set it as the default C++ compiler for Node.js ;)