Error when installing pg node module

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 ?

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>

In windows 8 64Bits configure as variáveis do ambiente Iniciar > Propriedades do computador > configurações avançadas do sistema > Avançado > Variáveis do Ambiente.

Edite a variável Path [c:\Program Files\PostgreSQL\9.3\bin]