Error installing pg node module

I want to install the pg node module, and this is the problem I 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 

Can anyone help me?

+4
source share
2 answers

pg_config is a PostgreSQL executable package. Before installing the node pg module, you must ensure that it is installed first.

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

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

You will see pg_config.exe in the list. Also, make sure pg_config.exe is in your PATH when reinstalling the pg node module. You can verify this by running pg_config.exe in the same current working directory, run npm install <module>

+1
source

On Windows 8 64Bits; configure environment variables as follows:

Right-click My Computer and select Properties , go to the "Advanced" tab, click "Environment Variables".

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

-1
source

Source: https://habr.com/ru/post/1446716/


All Articles