node.js - Error installing node-postgres on Amazon Linux. Missing pg_config.h file -


this error seems common on windows boxes, amazon linux ec2 instance throwing error when npm install pg:

../src/binding.cc:1:23: fatal error: pg_config.h: no such file or directory  #include <pg_config.h>                        ^ compilation terminated. make: *** [release/obj.target/binding/src/binding.o] error 1 make: leaving directory `/home/ec2-user/macros/test/statehash/node_modules/pg/build' gyp err! build error  gyp err! stack error: `make` failed exit code: 2 gyp err! stack     @ childprocess.onexit (/usr/lib/node_modules/node-gyp/lib/build.js:267:23) gyp err! stack     @ childprocess.eventemitter.emit (events.js:98:17) gyp err! stack     @ process.childprocess._handle.onexit (child_process.js:807:12) gyp err! system linux 3.4.82-69.112.amzn1.x86_64 gyp err! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp err! cwd /home/ec2-user/macros/test/statehash/node_modules/pg gyp err! node -v v0.10.28 gyp err! node-gyp -v v0.10.6 gyp err! not ok 

i'm on amazon linux 2014.03, , it's micro instance running node 0.10.28.

postgres 9.2.7 installed amazon repos. specifically, postgresql9* packages.

on fresh updatedb, locate pg_config returns

/usr/bin/pg_config /usr/share/locale/cs/lc_messages/pg_config-9.2.mo /usr/share/locale/de/lc_messages/pg_config-9.2.mo /usr/share/locale/es/lc_messages/pg_config-9.2.mo /usr/share/locale/fr/lc_messages/pg_config-9.2.mo /usr/share/locale/it/lc_messages/pg_config-9.2.mo /usr/share/locale/ja/lc_messages/pg_config-9.2.mo /usr/share/locale/ko/lc_messages/pg_config-9.2.mo /usr/share/locale/nb/lc_messages/pg_config-9.2.mo /usr/share/locale/pl/lc_messages/pg_config-9.2.mo /usr/share/locale/pt_br/lc_messages/pg_config-9.2.mo /usr/share/locale/ro/lc_messages/pg_config-9.2.mo /usr/share/locale/ru/lc_messages/pg_config-9.2.mo /usr/share/locale/sv/lc_messages/pg_config-9.2.mo /usr/share/locale/ta/lc_messages/pg_config-9.2.mo /usr/share/locale/tr/lc_messages/pg_config-9.2.mo /usr/share/locale/zh_cn/lc_messages/pg_config-9.2.mo /usr/share/locale/zh_tw/lc_messages/pg_config-9.2.mo /usr/share/man/man1/pg_config.1.gz 

but locate pg_config.h returns nothing.

any ideas?

the postgresql9, postgresql9-libs, , postgresql9-server installed default, not postgresql9-devel.

the header files required node-postgres in missing development package. following steps fixed problem:

  1. remove node-postgres directory:

    $ rm -rf node_modules/pg

  2. install postgres development package repos (match version - amazon repos mess when comes postgres):

    $ sudo yum install postgresql9-devel

  3. reinstall node-postgres (i'm doing locally, might using -g option):

    $ npm install pg

the pg_config.h file should there, installation should work fine!


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -