我想安装 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 Filesnodejsnode_modulesnpmnode_modulesnode-gyplibconfigure
.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:wampwwwgoogleMapnode_modulespg
gyp ERR! node -v v0.8.14
gyp ERR! node-gyp -v v0.7.1
gyp ERR! not ok
pg@0.8.7 node_modulespg
└── generic-pool@1.0.12
谁能帮我?
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
中。您可以通过在运行npm install <module>
的同一当前工作目录中运行pg_config.exe
来检查或
在 Windows 8 64 位中;按如下方式配置环境变量:
右键单击"My Computer
",然后单击"Properties
",单击"高级"选项卡,再单击"环境变量"。
编辑%PATH%
变量;并添加c:Program FilesPostgreSQL9.3bin