2014-06-26 7 views
6

Questo errore sembra comune su macchine Windows, ma il mio esempio Amazon EC2 Linux sta gettando questo errore quando npm install pg:Errore durante l'installazione di node-postgres su Amazon Linux. Manca il file pg_config.h

../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 with exit code: 2 
gyp ERR! stack  at ChildProcess.onExit (/usr/lib/node_modules/node-gyp/lib/build.js:267:23) 
gyp ERR! stack  at ChildProcess.EventEmitter.emit (events.js:98:17) 
gyp ERR! stack  at 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 

Sono su Amazon Linux 2.014,03, ed è un micro istanza in esecuzione nodo 0.10.28.

Postgres 9.2.7 viene installato dai repository Amazon. In particolare, i pacchetti postgresql9*.

su una nuova updatedb, locate pg_config rendimenti

/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 

Ma locate pg_config.h restituisce nulla.

Qualche idea?

risposta

7

Il postgresql9, postgresql9-libs e postgresql9-server sono stati installati per impostazione predefinita, ma non postgresql9-devel.

I file di intestazione richiesti da node-postgres sono nel pacchetto di sviluppo mancante. I seguenti passaggi fissati il ​​mio problema:

  1. rimuovere la directory node-postgres:

    $ rm -rf node_modules/pg

  2. Installare il pacchetto di sviluppo Postgres dai pronti contro termine (abbinare la versione con attenzione - i pronti contro termine Amazon sono un disastro quando si tratta di postgres):

    $ sudo yum install postgresql9-devel

  3. Reinstallare node-postgres (lo sto facendo a livello locale, si potrebbero utilizzare l'opzione -g):

    $ npm install pg

Il file pg_config.h dovrebbe essere lì, così l'installazione dovrebbe funzionare bene!

+2

Non riesco a credere che questo non abbia più upvotes. Risolto il mio problema – Sebastian

Problemi correlati