Skip to content

Cannot Install #602

Closed
DaAwesomeP opened this Issue Jun 11, 2014 · 5 comments

3 participants

@DaAwesomeP

When trying to install, I see:

'pg_config' is not recognized as an internal or external command,
operable program or batch file.
gyp: Call to 'pg_config --includedir' returned exit status 1. 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:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\configure.js:424:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Path\to\project\node_modules\pg
gyp ERR! node -v v0.10.18
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok

There is nothing added to the error when running NPM with --verbose. I have also tried clearing the NPM cache. According to Travis CI, it passes on Linux.


Windows 8 Pro 32-bit
NodeJS 0.10.18
NPM 1.3.8

@brianc
Owner
brianc commented Jun 11, 2014

Sorry you're having problems compiling on windows. There are two different things you can do:

1) make sure pg_config & libpq are available to you on windows. Not 100% sure how to do this - windows support for compiling libpq bindings was added by the community.

2) install this instead: same exact code but without the compilation step https://github.com/brianc/node-postgres-pure

@DaAwesomeP

I found pg_config.exe and libpq.dll in C:\Program Files\PostgreSQL\9.3\bin. I then added that folder to my system path environment variable. It seemed to have helped some. All of the blurred out Paths simply go to my project directory.
pg install 1
I should note that I have Visual Studio C++ Express 2010 installed. Is there a version that pg is confirmed to compile on? Are these new warnings coming from libpq?

install this instead: same exact code but without the compilation step https://github.com/brianc/node-postgres-pure

I want to use Knex, which I'm pretty sure doesn't support that. The good thing is that the completed production code will be on a Linux server. However, Windows development really sucks. I will use Vagrant if I really have to, but I would prefer not to.

@hoegaarden

Hey @DaAwesomeP,
knex should support pg AND pg.js (= node-postgres-pure), see here.

@DaAwesomeP

knex should support pg AND pg.js (= node-postgres-pure), see here.

I guess so. That seems to work perfectly. However, since that is an alternative fix and not really helping the problem, I will keep this open. I think that this should be fixed.

@DaAwesomeP

I just realized that I fixed it! I had both pg and pg.js installed at the same time. When I removed pg, Knex stopped working. That's probably another bug that I'll open later. It said that pgpass was missing.

To build node-postgres on Windows

  • Install Visual Studio C++ (tested with Express 2010)
  • Add the path to tour Postgres bin to the system path ENV (i.e. C:\Program Files\PostgreSQL\9.3\bin)
  • Make sure that both libpq.dll and pg_config.exe are in that folder.
  • npm install pg
@DaAwesomeP DaAwesomeP closed this Jun 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.