linux node 缺so,在Amazon Linux上安裝node-postgres時出錯。缺少pg_config.h文件

This error seems common on windows boxes, but my Amazon Linux EC2 instance is throwing this error when I npm install pg:

這個錯誤在Windows機器上似乎很常見,但是當我在安裝pg時,我的Amazon Linux EC2實例會拋出此錯誤:

../src/binding.cc:1:23: fatal error: pg_config.h: No such file or directory

#include

^

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

I'm on Amazon Linux 2014.03, and it's a micro instance running node 0.10.28.

我在Amazon Linux 2014.03上,它是一個運行節點0.10.28的微實例。

Postgres 9.2.7 is installed from the Amazon repos. Specifically, the postgresql9* packages.

Postgres 9.2.7是從亞馬遜回購安裝的。具體來說,是postgresql9 *包。

On a fresh updatedb, locate pg_config returns

在新的updatedb上,找到pg_config返回

/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.

但是找到pg_config.h什么都不返回。

Any ideas?

1 个解决方案

#1

7

The postgresql9, postgresql9-libs, and postgresql9-server were installed by default, but not postgresql9-devel.

postgresql9,postgresql9-libs和postgresql9-server默認安裝,但不是postgresql9-devel。

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

node-postgres所需的頭文件位於缺少的開發包中。以下步驟解決了我的問題:

Remove the node-postgres directory:

刪除node-postgres目錄:

$ rm -rf node_modules/pg

$ rm -rf node_modules / pg

Install the postgres development package from the repos (match your version carefully - the Amazon repos are a mess when it comes to postgres):

從repos安裝postgres開發包(仔細地匹配你的版本 - 在postgres上,亞馬遜的回購是一團糟):

$ sudo yum install postgresql9-devel

$ sudo yum install postgresql9-devel

Reinstall node-postgres (I'm doing it locally, you might be using the -g option):

重新安裝node-postgres(我在本地做,你可能正在使用-g選項):

$ npm install pg

$ npm install pg

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

pg_config.h文件應該在那里,所以安裝應該正常工作!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值