brianc / node-pg-native

Native (C/C++) bindings to PostgreSQL with sync and async options.
247 stars 44 forks source link

node-gyp building error #44

Open devmetal opened 8 years ago

devmetal commented 8 years ago

Hi, i have an issue with this module install. I followed the manual, installed postgresql added to path and i checked the dll and config files.

I use windows 8.1, visual studio 2015 community with the latest npm and node version.

Here is the output of npm install pg-native -g --verbose > output.txt command:


> libpq@1.8.1 install C:\Users\Ádám\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq
> node-gyp rebuild

C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq>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.
Build started 2016.03.18. 15:39:28.
Project "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|x64".
The target "AfterGenerateAppxManifest" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.Net.CoreRuntime.targets (68,11)" does not exist in the project, and will be ignored.
The target "_GeneratePrisForPortableLibraries" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.Net.CoreRuntime.targets (177,11)" does not exist in the project, and will be ignored.
The target "AfterGenerateAppxManifest" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets (126,11)" does not exist in the project, and will be ignored.
The target "AfterGenerateAppxManifest" listed in an AfterTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\.NetNative\Microsoft.NetNative.targets (174,11)" does not exist in the project, and will be ignored.
The target "BeforeGenerateProjectPriFile" listed in a BeforeTargets attribute at "C:\Program Files (x86)\MSBuild\Microsoft\NuGet\Microsoft.NuGet.targets (149,61)" does not exist in the project, and will be ignored.
Project "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\binding.sln" (1) is building "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj" (2) on node 1 (default targets).
PrepareForBuild:
  Creating directory "Release\obj\addon\".
  Creating directory "Release\obj\addon\addon.tlog\".
InitializeBuildStatus:
  Creating "Release\obj\addon\addon.tlog\unsuccessfulbuild" because "AlwaysCreate" was specified.
ClCompile:
  E:\Programf�jlok (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64\CL.exe /c /I"C:\Users\�d�m\.node-gyp\5.0.0\include\node" /I"C:\Users\�d�m\.node-gyp\5.0.0\src" /I"C:\Users\�d�m\.node-gyp\5.0.0\deps\uv\include" /I"C:\Users\�d�m\.node-gyp\5.0.0\deps\v8\include" /IE:\Program /I..\Files\PostgreSQL\9.3\include /I..\..\nan /Zi /nologo /W3 /WX- /Ox /Ob2 /Oi /Ot /Oy /GL /D NODE_GYP_MODULE_NAME=addon /D WIN32 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _HAS_EXCEPTIONS=0 /D BUILDING_V8_SHARED=1 /D BUILDING_UV_SHARED=1 /D BUILDING_NODE_EXTENSION /D _WINDLL /GF /Gm- /MT /GS /Gy /fp:precise /Zc:wchar_t /Zc:forScope /Zc:inline /GR- /Fo"Release\obj\addon\\" /Fd"Release\obj\addon\vc140.pdb" /Gd /TP /wd4351 /wd4355 /wd4800 /wd4251 /errorReport:queue /MP ..\src\connection.cc "..\src\connect-async-worker.cc" ..\src\addon.cc
  connection.cc
  connect-async-worker.cc
  addon.cc
c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\addon.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connect-async-worker.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connection.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
Done Building Project "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj" (default targets) -- FAILED.
Done Building Project "C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\binding.sln" (default targets) -- FAILED.

Build FAILED.

"C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\binding.sln" (default target) (1) ->
"C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj" (default target) (2) ->
(ClCompile target) -> 
  c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\addon.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
  c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connect-async-worker.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]
  c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connection.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]

    0 Warning(s)
    3 Error(s)

Time Elapsed 00:00:02.03
C:\Users\Ádám\AppData\Roaming\npm
`-- (empty)

Thank you :)

alallier commented 8 years ago

I have the same problem on Windows 10

djaonourside commented 8 years ago

the same problem windows 10

Titozzz commented 8 years ago

Same thing W10

devmetal commented 8 years ago

I'm totaly desperate. The funny thing is, in our office, on windows7 with vs2015, its working perfectly (lot of warning but working). But in my personal laptop with windows 8.1, same vs2015, its always got a same error with the headers:

c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\addon.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj] c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connect-async-worker.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj] c:\users\�d�m\appdata\roaming\npm\node_modules\pg-native\node_modules\libpq\src\addon.h(5): fatal error C1083: Cannot open include file: 'libpq-fe.h': No such file or directory (compiling source file ..\src\connection.cc) [C:\Users\�d�m\AppData\Roaming\npm\node_modules\pg-native\node_modules\libpq\build\addon.vcxproj]

I reinstalled my node, npm, visualstudio, postgresql everything in 64 bit, twice.

Next weekend i try reinstall my windows.

alallier commented 8 years ago

Really @devmetal you're going to take it all the way too reinstalling windows? God bless ya

devmetal commented 8 years ago

@alallier I don't know what can i do. Maybe we have to try install a specific version? The problem is, im not a low level programer.

tintoverano commented 8 years ago

@devmetal did you do this?

You need PostgreSQL client libraries & tools installed. An easy way to check is to type pg_config. If pg_config is in your path, you should be good to go. If it's not in your path you'll need to consult operating specific instructions on how to go about getting it there.

Some ways I've done it in the past:

On OS X: brew install postgres
On Ubuntu: apt-get install libpq-dev
On RHEL/CentOS: yum install postgresql-devel
On Windows:
Install Visual Studio C++ (successfully built with Express 2010). Express is free.
Install PostgreSQL (http://www.postgresql.org/download/windows/)
Add your Postgre Installation's bin folder to the system path (i.e. C:\Program Files\PostgreSQL\9.3\bin).
Make sure that both libpq.dll and pg_config.exe are in that folder.
devmetal commented 8 years ago

@tintoverano Yes but not worked for me. But, i reinstalled my windows and now its working for me.

Xflofoxx commented 8 years ago

@tintoverano It seems that requires libpq.lib and not libpq.dll, is it possible?

AlokJoshi commented 7 years ago

Hi I get the following error when id do npm install pg-native --save. I am using Windows 7

C:\WS\pgnativetest\node_modules\pg-native\node_modules\libpq>if not defined npm config_node_gyp (node "C:\Users\Alok\AppData\Roaming\npm\node_modules\npm\bin\n de-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild ) gyp WARN install got an error, rolling back install gyp ERR! configure error gyp ERR! stack Error: 404 status code downloading 64-bit node.lib gyp ERR! stack at Request. (C:\Users\Alok\AppData\Roaming\npm\no e_modules\npm\node_modules\node-gyp\lib\install.js:403:20) gyp ERR! stack at emitOne (events.js:95:20) gyp ERR! stack at Request.emit (events.js:182:7) gyp ERR! stack at Request.onRequestResponse (C:\Users\Alok\AppData\Roaming\ pm\node_modules\npm\node_modules\request\request.js:1142:10) gyp ERR! stack at emitOne (events.js:90:13) gyp ERR! stack at ClientRequest.emit (events.js:182:7) gyp ERR! stack at HTTPParser.parserOnIncomingClient (_http_client.js:469:21

gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:103:2 ) gyp ERR! stack at TLSSocket.socketOnData (_http_client.js:359:20) gyp ERR! stack at emitOne (events.js:90:13) gyp ERR! System Windows_NT 6.1.7601 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Users\Alok\AppDat \Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "r build" gyp ERR! cwd C:\WS\pgnativetest\node_modules\pg-native\node_modules\libpq gyp ERR! node -v v5.11.0 gyp ERR! node-gyp -v v2.0.1 gyp ERR! not ok npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\Alok\AppData\ oaming\npm\node_modules\npm\bin\npm-cli.js" "install" "pg-native" "--save" npm ERR! node v5.11.0 npm ERR! npm v2.11.2 npm ERR! code ELIFECYCLE

npm ERR! libpq@1.8.5 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the libpq@1.8.5 install script 'node-gyp rebuild'. npm ERR! 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 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! C:\WS\pgnativetest\npm-debug.log

Can you help? Thanks.

devmetal commented 7 years ago

Hi, i suggest to try the latest npm version:

npm install npm@latest -g

If you get some errors, or npm not installed, try this: https://www.npmjs.com/package/npm-windows-upgrade

AlokJoshi commented 7 years ago

@devmetal Thank you very much for responding. I will try it (maybe) because i have many apps that are working on the current version of npm and fixing this app may break them. In any case thanks a lot for your response.

anonmily commented 7 years ago

@tintoverano @devmetal Thanks! I had this issue on a Linux machine and install libpq-dev fixed the problem for me. :+1: :clap:

manju4ever commented 6 years ago

Hi all,

We had the same issue in Windows 10. So the thing that we observed was the path C:\Program Files\PostgreSQL\9.6\bin should be moved up in the Pathvariable. So that cygwin and other tools path should come later. If this is done right, thelibpq-fq.h will be resolved while building pg related modules.

nagylzs commented 6 years ago

I have the same issue, but I have PostgreSQL 10 installed. There is no libpg-fq.h file at all under the includes dir. I guess it won't compile with version 10. Do I have to install 9.6 just to install it against an older version if libpq?

rjkunde commented 6 years ago

I also had PostgreSQL installed to D:\Program Files\PostgreSQL. Both \bin and \include were added to path too. But it would still fail with: C1083: Cannot open include file: 'libpq-fe.h

The only fix that worked for me (Windows 10) was to uninstall PostgreSQL, then install to C: Then I added: C:\Program Files\PostgreSQL\10\bin C:\Program Files\PostgreSQL\10\include

To path: from explorer, right click This PC, Advanced system settings, Environment Variables, under system variables --> highlight "Path", Edit.., New, then OK.

Open up a new Git Bash or Powershell screen (it won't pick up a change in the PATH unless you do)

Now I can install pg-native without issue.

devmetal commented 6 years ago

@rjkunde Yes yes. Currently i don't use this package, it cool, not because its bad or something, i was satisfied with this, currenty we are not using postgre. Anyway i remember the solution was the same, i had to install the postgre to C: drive, above windows :)

subasasoccer commented 6 years ago

@manju4ever thank so much

remojansen commented 6 years ago

In Linux Mint apt install libpq-dev solved the issue for me.

GreggOrdHume commented 6 years ago

@remojansen - Thank you. I tried everything under the sun - spent 4 hours looking for answers then this helped me. apt install libpq-dev

remjx commented 4 years ago

On Windows, I had it added to my environment variables PATH for user variables, but it needed to be added in system variables

jcuenod commented 3 years ago

I needed postgresql-libs on Arch

mattpen commented 2 years ago

RHEL8 here - I fixed it by running dnf install redhat-rpm-config libpq-devel