1

在 Windows 7 上的 nodejs (0.10.13) 上使用 any-db (0.0.6) 和 pg (2.1.0) 运行查询。使用 npm 的所有安装似乎都正常。可以设置连接池,但失败并出现低级错误:

// Runs OK
var anyDB = require('any-db');
var pool = anyDB.createPool(dbUrl, {min: 2, max: 10})
// Fails here... Content of sql doesn't seem to matter.
var q = pool.query(sql);

抛出:断言失败:0,文件 c:\node-v0.10.13-x64\deps\uv\src\win\req-inl.h,第 219 行

(不能被 try/catch 捕获,此外该目录甚至不存在......)

尝试的节点版本:0.10.12 和 0.10.13

我在安装 pg 时遇到了一些问题,但似乎没问题,这是安装消息:

C:\ETL-Devel>npm install pg
npm http GET https://registry.npmjs.org/pg
npm http 304 https://registry.npmjs.org/pg
npm http GET https://registry.npmjs.org/ref/0.1.3
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/ref/0.1.3
npm http GET https://registry.npmjs.org/ref/-/ref-0.1.3.tgz
npm http 304 https://registry.npmjs.org/generic-pool/2.0.3
npm http GET https://registry.npmjs.org/generic-pool/-/generic-pool-2.0.3.tgz
npm http 304 https://registry.npmjs.org/buffer-writer/1.0.0
npm http 200 https://registry.npmjs.org/ref/-/ref-0.1.3.tgz
npm http 200 https://registry.npmjs.org/generic-pool/-/generic-pool-2.0.3.tgz
npm http GET https://registry.npmjs.org/cloned/0.0.1
npm http GET https://registry.npmjs.org/bindings
npm http GET https://registry.npmjs.org/debug
npm http 304 https://registry.npmjs.org/cloned/0.0.1
npm http GET https://registry.npmjs.org/rmdir
npm http 304 https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/debug

> ref@0.1.3 install C:\ETL-Devel\node_modules\pg\node_modules\ref
> node-gyp rebuild


C:\ETL-Devel\node_modules\pg\node_modules\ref>node "C:\Program Files\nodejs\node
_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebu
ild
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
npm http 304 https://registry.npmjs.org/rmdir
  binding.cc
C:\Users\User\.node-gyp\0.10.13\deps\v8\include\v8.h(184): warning C4506: no de
finition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Hand
le<T>)' [C:\ETL-Devel\node_modules\pg\node_modules\ref\build\binding.vcxproj]
          with
          [
              T=v8::Object
          ]
     Creating library C:\ETL-Devel\node_modules\pg\node_modules\ref\build\Relea
  se\binding.lib and object C:\ETL-Devel\node_modules\pg\node_modules\ref\build
  \Release\binding.exp
  Generating code
  Finished generating code
  binding.vcxproj -> C:\ETL-Devel\node_modules\pg\node_modules\ref\build\Releas
  e\\binding.node

> pg@2.1.0 install C:\ETL-Devel\node_modules\pg
> node-gyp rebuild || (exit 0)


C:\ETL-Devel\node_modules\pg>node "C:\Program Files\nodejs\node_modules\npm\bin\
node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
  binding.cc
..\src\binding.cc(348): warning C4800: 'int' : forcing value to bool 'true' or
'false' (performance warning) [C:\ETL-Devel\node_modules\pg\build\binding.vcxpr
oj]
..\src\binding.cc(849): warning C4267: 'argument' : conversion from 'size_t' to
 'int', possible loss of data [C:\ETL-Devel\node_modules\pg\build\binding.vcxpr
oj]
C:\Users\User\.node-gyp\0.10.13\deps\v8\include\v8.h(218): warning C4506: no de
finition for inline function 'v8::Persistent<T> v8::Persistent<T>::New(v8::Hand
le<T>)' [C:\ETL-Devel\node_modules\pg\build\binding.vcxproj]
          with
          [
              T=v8::Object
          ]
     Creating library C:\ETL-Devel\node_modules\pg\build\Release\binding.lib an
  d object C:\ETL-Devel\node_modules\pg\build\Release\binding.exp
  Generating code
  Finished generating code
  binding.vcxproj -> C:\ETL-Devel\node_modules\pg\build\Release\\binding.node
pg@2.1.0 node_modules\pg
├── generic-pool@2.0.3
├── buffer-writer@1.0.0 (cloned@0.0.1)
└── ref@0.1.3 (bindings@1.1.1, debug@0.7.2)

任何想法或帮助将不胜感激!


更新 1

重新启动计算机后,错误消息已更改为: Assertion failed: 0, file src\win\poll.c, line 87

这似乎是指这个:https ://github.com/joyent/libuv/blob/master/src/win/poll.c

我也间歇性地收到另一个错误。

尝试了 v0.10.10 .. 现在刚刚收到第一个错误。

更新 2

我尝试使用节点 v0.10.13-x86(而不是 x64)。重新安装 pg 后,我的代码似乎可以正常运行,但在重新安装 pg(使用 npm)期间会引发错误:

... Creating library C:\ETL-Devel\node_modules\pg\build\Release\binding.lib an
d object C:\ETL-Devel\node_modules\pg\build\Release\binding.exp
binding.obj : error LNK2001: unresolved external symbol _PQfreemem [C:\ETL-Deve
l\node_modules\pg\build\binding.vcxproj]
binding.obj : error LNK2001: unresolved external symbol _PQflush [C:\ETL-Devel\
node_modules\pg\build\binding.vcxproj]

... [34 statements removed]

binding.obj : error LNK2001: unresolved external symbol _PQgetisnull [C:\ETL-De
vel\node_modules\pg\build\binding.vcxproj]
C:\ETL-Devel\node_modules\pg\build\Release\binding.node : fatal error LNK1120:
37 unresolved externals [C:\ETL-Devel\node_modules\pg\build\binding.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_mo
dules\npm\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:789:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\nod
e_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\ETL-Devel\node_modules\pg
gyp ERR! node -v v0.10.13
gyp ERR! node-gyp -v v0.10.2
gyp ERR! not ok
pg@2.1.0 node_modules\pg
├── generic-pool@2.0.3
├── buffer-writer@1.0.0 (cloned@0.0.1)
└── ref@0.1.3 (bindings@1.1.1, debug@0.7.2)
4

0 回答 0