4

I'd like to install pg node module and this is the issue I've got :

Exception: Call to 'pg_config --libdir' 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:350:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:99:17)
gyp ERR! stack     at Process._handle.onexit (child_process.js:678:10)
gyp ERR! System Windows_NT 6.1.7600
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild
"
gyp ERR! cwd C:\wamp\www\googleMap\node_modules\pg
gyp ERR! node -v v0.8.14
gyp ERR! node-gyp -v v0.7.1
gyp ERR! not ok
pg@0.8.7 node_modules\pg
└── generic-pool@1.0.12

Could anyone help me ?

Scott Weldon
  • 8,032
  • 6
  • 43
  • 60
Cherif
  • 4,863
  • 7
  • 29
  • 52
  • 1
    Well, what does `pg_config --libdir` return when run on the command line? PostgreSQL version? Do you have the Microsoft Windows SDK installed, since you're trying to compile software? (Isn't there a binary of the Pg module for node.js available so you can avoid that on Windows?) – Craig Ringer Nov 18 '12 at 02:15

2 Answers2

1

pg_config is an executable of the PostgreSQL package. You need to make sure this gets installed first, before installing the node pg module.

The reason for this, is that the pg module actually compiles the driver using the pgsql tools and possibly the C/C++ code, which is why the node module is using node-gyp.

Read this article for more details: http://www.postgresql.org/docs/8.2/static/install-win32.html

You'll see pg_config.exe is on the list. Also, make sure that pg_config.exe is in your PATH when you try to install your pg node module again. You can check or this, by running pg_config.exe in the same current working directory you run npm install <module>

EhevuTov
  • 19,227
  • 16
  • 63
  • 71
-1

In windows 8 64Bits; configure your environment variables as follows:

Right-click My Computer, and then click Properties, click the Advanced tab, click Environment variables.

Edit the %PATH% variable; and add c:\Program Files\PostgreSQL\9.3\bin

Sjon
  • 4,605
  • 6
  • 24
  • 42
Oberdan
  • 177
  • 3
  • 8