【问题标题】:i can't be install db-mysql on node.js project我不能在 node.js 项目上安装 db-mysql
【发布时间】:2012-05-09 09:29:54
【问题描述】:

在 node.js proeject 上安装 db-mysql 包时。发生了这个错误

npm http GET http://registry.npmjs.org/db-mysql
npm http 304 http://registry.npmjs.org/db-mysql

> db-mysql@0.7.6 install D:\vhosts\node.m.com\node_modules\db-mysql
> node-waf configure build

'node-waf' is not recognized as an internal or external command,
operable program or batch file.

> db-mysql@0.7.6 preuninstall D:\vhosts\node.m.com\node_modules\db-mysql
> rm -rf build/*

'rm' is not recognized as an internal or external command,
operable program or batch file.
npm WARN continuing anyway db-mysql@0.7.6 preuninstall: `rm -rf build/*`
npm WARN continuing anyway `cmd "/c" "rm -rf build/*"` failed with 1

npm ERR! db-mysql@0.7.6 install: `node-waf configure build`
npm ERR! `cmd "/c" "node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the db-mysql@0.7.6 install script.
npm ERR! This is most likely a problem with the db-mysql package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls db-mysql
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Windows_NT 6.1.7600
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nod
ejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "db-mysql"

【问题讨论】:

  • 我认为node-waf 在 Windows 上不可用。它用于构建原生扩展(今天建议使用gyp)。您可能想试试 felixge 的 mysql module ——我认为它的使用范围更广。

标签: mysql node.js


【解决方案1】:

您正在尝试使用 npm 从 Windows 下的源代码安装二进制模块,目前该模块开箱即用无法正常工作。 node-waf 只是一个构建工具,你至少还需要编译器和节点头。

可能的解决方案:

  • 尝试手动安装(阅读this article
  • 使用非二进制、仅限javascript的模块,例如node-mysql (npm install mysql)

【讨论】:

    【解决方案2】:

    在您的命令提示符或终端尝试此命令:npm install mysql... 为 node.js 安装包的最常见方法是通过 npm。

    【讨论】:

    • 提问者正在使用npm。您建议的命令不起作用。
    • mysql 和 db-mysql 是两个不同的模块。一个是本地的,另一个不是。它不应作为解决方案给出,而应作为替代方案提及。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-13
    • 2018-07-26
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多