4

我想安装 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

谁能帮助我?

4

2 回答 2

1

pg_config是 PostgreSQL 包的可执行文件。在安装 node 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>

于 2012-12-22T18:28:42.913 回答
-1

在 Windows 8 64 位;如下配置环境变量:

右键单击My Computer,然后单击Properties,单击高级选项卡,单击环境变量

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

于 2014-05-15T01:16:50.060 回答