2013-04-29 31 views
2

林在Windows 7命令提示符,,,我试着通过对安设:npm install node-mysql如何安装node-mysql?

即时得到这样的:

C:\Program Files\nodejs>npm install node-mysql 
npm http GET https://registry.npmjs.org/node-mysql 
npm http 404 https://registry.npmjs.org/node-mysql 
npm ERR! 404 'node-mysql' is not in the npm registry. 
npm ERR! 404 You should bug the author to publish it 
npm ERR! 404 
npm ERR! 404 Maybe try 'npm search mysql' 
npm ERR! 404 
npm ERR! 404 Note that you can also install from a 
npm ERR! 404 tarball, folder, or http url, or git url. 

npm ERR! System Windows_NT 6.1.7600 
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "node-mysql" 
npm ERR! cwd C:\Program Files\nodejs 
npm ERR! node -v v0.10.4 
npm ERR! npm -v 1.2.18 
npm ERR! code E404 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  C:\Program Files\nodejs\npm-debug.log 
npm ERR! not ok code 0 

如何解决呢?我试着去寻找npm search node-mysql ,,我不能发现它在列表

回答

9

尝试:

npm install mysql 

节点mSQL的(https://github.com/felixge/node-mysql/blob/master/package.json)被命名为中的package.json简单MySQL和其下的NPM存在同名注册表中。

+0

C:\ Program Files文件\的NodeJS> NPM安装mysql NPM HTTP GET https://registry.npmjs.org/mysql NPM HTTP 304 https://registry.npmjs.org/mysql 给304 – 2013-04-29 14:19:08

+0

尝试在不同的目录比程序文件,因为你需要管理员权限写在那里 – 2013-04-29 14:22:30

+0

好吧..但仍然没有privillege错误 – 2013-04-29 14:28:25

0

以下是加入了MySQL模块节点JS

1打开命令提示符的步骤

键入npm安装g-mysql以供全局使用。

这将需要时间。 mysql模块不会安装在nodejs模块目录中。请将模块从管理员目录复制到nodejs模块文件夹。

要检查安装在模块或不请到节点JS命令行并键入

require_resolve(“的MySQL”);

模块路径将显示

0

请按照给定的步骤,这工作对我来说:

  1. 在这位置的名为mysql的文件夹:

    C:\Users\newusers\AppData\Roaming\npm\node_modules 
    
  2. 然后运行命令npm -g install mysql

+0

你不需要制作文件夹,npm会为你做到这一点 – 2017-05-14 10:07:58