npm包构建失败,如何最好地调试?

时间:2012-05-17 17:35:44

标签: mysql node.js

我正在尝试在Mac OS X上安装一个mysql节点包。我正在尝试在本地运行一个客户端项目。

我已经安装了node和npm,它们工作正常,其他软件包安装得很好。我还编译/安装了完整的LAMP堆栈。

当下面的构建失败时,我没有看到任何有用的错误消息 - 只是有关未找到库的信息。如果不知道它找不到什么,我无法解决它。

有什么建议吗? MySQL已经安装了标准方式 - 下载软件包,./ configure,make / install。

$ npm install mysql-libmysqlclient
npm http GET https://registry.npmjs.org/mysql-libmysqlclient
npm http 304 https://registry.npmjs.org/mysql-libmysqlclient

> mysql-libmysqlclient@1.3.3 install /Users/botskonet/node_modules/mysql-libmysqlclient
> node-gyp rebuild

info it worked if it ends with ok 
spawn python [ '/Users/botskonet/.node-gyp/0.6.12/tools/gyp_addon',
  'binding.gyp',
  '-I/Users/botskonet/node_modules/mysql-libmysqlclient/build/config.gypi',
  '-f',
  'make' ]
spawn make [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings.o
  CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_connection.o
  CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_result.o
  CXX(target) Release/obj.target/mysql_bindings/src/mysql_bindings_statement.o
  SOLINK_MODULE(target) Release/mysql_bindings.node
ld: library not found for -lmysqlclient_r
collect2: ld returned 1 exit status
make: *** [Release/mysql_bindings.node] Error 1
ERR! Error: `make` failed with exit code: 2
    at Array.0 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:176:25)
    at EventEmitter._tickCallback (node.js:192:40)
ERR! not ok

npm ERR! mysql-libmysqlclient@1.3.3 install: `node-gyp rebuild`
npm ERR! `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! 
npm ERR! Failed at the mysql-libmysqlclient@1.3.3 install script.
npm ERR! This is most likely a problem with the mysql-libmysqlclient package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls mysql-libmysqlclient
npm ERR! There is likely additional logging output above.
npm ERR! 
npm ERR! System Darwin 11.3.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "mysql-libmysqlclient"
npm ERR! cwd /Users/botskonet/Sites/SportsBuddies
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.15
npm ERR! code ELIFECYCLE
npm ERR! message mysql-libmysqlclient@1.3.3 install: `node-gyp rebuild`
npm ERR! message `sh "-c" "node-gyp rebuild"` failed with 1
npm ERR! errno {}
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/botskonet/Sites/SportsBuddies/npm-debug.log
npm not ok

1 个答案:

答案 0 :(得分:1)

查看README中的依赖项部分并发布#107。要构建mysql-libmysqlclient,你应该为它安装libmysqlclient和开发头文件,将MySQL bin目录的路径添加到$ PATH,将MySQL lib目录添加到$ DYLD_LIBRARY_PATH。