0

正在尝试安装pg。这是完整的日志:

$ npm install pg --save
npm WARN package.json hs-app@0.0.0 No description
npm WARN package.json hs-app@0.0.0 No repository field.
npm WARN package.json hs-app@0.0.0 No README data
npm http GET https://registry.npmjs.org/pg
npm http 304 https://registry.npmjs.org/pg
npm http GET https://registry.npmjs.org/generic-pool/2.0.3
npm http GET https://registry.npmjs.org/buffer-writer/1.0.0
npm http 304 https://registry.npmjs.org/generic-pool/2.0.3
npm http 304 https://registry.npmjs.org/buffer-writer/1.0.0
npm http GET https://registry.npmjs.org/cloned/0.0.1
npm http GET https://registry.npmjs.org/async
npm http 304 https://registry.npmjs.org/cloned/0.0.1
npm http 304 https://registry.npmjs.org/async
npm http GET https://registry.npmjs.org/rmdir
npm http 304 https://registry.npmjs.org/rmdir

> pg@2.3.1 install /Users/David/Developer/hs-app/node_modules/pg
> node-gyp rebuild || (exit 0)

  CXX(target) Release/obj.target/binding/src/binding.o
../src/binding.cc:49:51: warning: 'New' is deprecated [-Wdeprecated-declarations]
    Local<FunctionTemplate> t = FunctionTemplate::New(New);
                                                  ^
../src/binding.cc:54:19: error: use of undeclared identifier 'NODE_PSYMBOL'
    emit_symbol = NODE_PSYMBOL("emit");
                  ^
../src/binding.cc:55:23: error: use of undeclared identifier 'NODE_PSYMBOL'
    severity_symbol = NODE_PSYMBOL("severity");
                      ^
../src/binding.cc:56:19: error: use of undeclared identifier 'NODE_PSYMBOL'
    code_symbol = NODE_PSYMBOL("code");
                  ^
../src/binding.cc:57:21: error: use of undeclared identifier 'NODE_PSYMBOL'
    detail_symbol = NODE_PSYMBOL("detail");
                    ^
../src/binding.cc:58:19: error: use of undeclared identifier 'NODE_PSYMBOL'
    hint_symbol = NODE_PSYMBOL("hint");
                  ^
../src/binding.cc:59:23: error: use of undeclared identifier 'NODE_PSYMBOL'
    position_symbol = NODE_PSYMBOL("position");
                      ^
../src/binding.cc:60:31: error: use of undeclared identifier 'NODE_PSYMBOL'
    internalPosition_symbol = NODE_PSYMBOL("internalPosition");
                              ^
../src/binding.cc:61:28: error: use of undeclared identifier 'NODE_PSYMBOL'
    internalQuery_symbol = NODE_PSYMBOL("internalQuery");
                           ^
../src/binding.cc:62:20: error: use of undeclared identifier 'NODE_PSYMBOL'
    where_symbol = NODE_PSYMBOL("where");
                   ^
../src/binding.cc:63:19: error: use of undeclared identifier 'NODE_PSYMBOL'
    file_symbol = NODE_PSYMBOL("file");
                  ^
../src/binding.cc:64:19: error: use of undeclared identifier 'NODE_PSYMBOL'
    line_symbol = NODE_PSYMBOL("line");
                  ^
../src/binding.cc:65:22: error: use of undeclared identifier 'NODE_PSYMBOL'
    routine_symbol = NODE_PSYMBOL("routine");
                     ^
../src/binding.cc:66:19: error: use of undeclared identifier 'NODE_PSYMBOL'
    name_symbol = NODE_PSYMBOL("name");
                  ^
../src/binding.cc:67:20: error: use of undeclared identifier 'NODE_PSYMBOL'
    value_symbol = NODE_PSYMBOL("value");
                   ^
../src/binding.cc:68:19: error: use of undeclared identifier 'NODE_PSYMBOL'
    type_symbol = NODE_PSYMBOL("dataTypeID");
                  ^
../src/binding.cc:69:22: error: use of undeclared identifier 'NODE_PSYMBOL'
    channel_symbol = NODE_PSYMBOL("channel");
                     ^
../src/binding.cc:70:22: error: use of undeclared identifier 'NODE_PSYMBOL'
    payload_symbol = NODE_PSYMBOL("payload");
                     ^
../src/binding.cc:71:22: error: use of undeclared identifier 'NODE_PSYMBOL'
    command_symbol = NODE_PSYMBOL("command");
                     ^
../src/binding.cc:73:45: error: address of overloaded function 'Connect' does not match required type 'void (const v8::FunctionCallbackInfo<v8::Value> &)'
    NODE_SET_PROTOTYPE_METHOD(t, "connect", Connect);
                                            ^~~~~~~
../src/binding.cc:447:8: note: candidate function has type mismatch at 1st parameter (expected 'const v8::FunctionCallbackInfo<v8::Value> &' but has 'const char *')
  bool Connect(const char* conninfo)
       ^
../src/binding.cc:107:3: note: candidate function has type mismatch at 1st parameter (expected 'const v8::FunctionCallbackInfo<v8::Value> &' but has 'const v8::Arguments &')
  Connect(const Arguments& args)
  ^
/Users/David/.node-gyp/0.11.4/src/node.h:152:60: note: passing argument to parameter 'callback' here
                                      v8::FunctionCallback callback) {
                                                           ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
1 warning and 20 errors generated.
make: *** [Release/obj.target/binding/src/binding.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/David/.nvm/v0.11.4/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:103:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Darwin 12.4.0
gyp ERR! command "node" "/Users/David/.nvm/v0.11.4/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/David/Developer/hs-app/node_modules/pg
gyp ERR! node -v v0.11.4
gyp ERR! node-gyp -v v0.10.9
gyp ERR! not ok 
pg@2.3.1 node_modules/pg
├── generic-pool@2.0.3
└── buffer-writer@1.0.0 (async@0.2.9, cloned@0.0.1)
4

1 回答 1

0

node-postgres的维护者Brian C在在 github 上打开的问题中回答了以下问题:

本机绑定不会在 v.0.11.x 上编译。过去 4 的每个次要版本都大幅更改了 C/C++ 层,并且本机绑定总是中断。在接近 v0.12.0 版本之前,我不会进行修复它们的工作,因为代码在节点端仍在不断变化,并且会再次中断。

好消息,你没有被淹没:

  1. require('pg')使用即使编译失败也会安装的非本地绑定 ( )
  2. 使用节点 v0.10.x
于 2013-09-12T07:33:59.130 回答