安装pg节点模块时出错

时间:2012-11-18 01:28:57

标签: node.js postgresql npm gyp node-gyp

我想安装pg节点模块,这是我遇到的问题:

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

有人能帮帮我吗?

2 个答案:

答案 0 :(得分:1)

pg_config是PostgreSQL包的可执行文件。在安装节点pg模块之前,您需要确保首先安装它。

原因是pg模块实际上使用pgsql工具和可能的C / C ++代码编译驱动程序,这就是节点模块使用node-gyp的原因。

阅读本文了解更多详情:http://www.postgresql.org/docs/8.2/static/install-win32.html

您会在列表中看到pg_config.exe。此外,当您再次尝试安装pg节点模块时,请确保pg_config.exe位于PATH。您可以通过在运行pg_config.exe

的同一当前工作目录中运行npm install <module>来检查或检查此项

答案 1 :(得分:-1)

在Windows 8 64位中;按如下方式配置环境变量:

右键点击My Computer,然后点击Properties,点击高级标签,点击环境变量

编辑%PATH%变量;并添加c:\Program Files\PostgreSQL\9.3\bin

相关问题