2014-02-24 116 views
0

我試圖與節點JSMySQL集羣節點JS連接錯誤

我的程序

var nosql = require('mysql-js'); 

var dbProperties = { 

    "implementation" : "ndb", 

    "database" : "users" 

}; 

nosql.openSession(dbProperties, null, onSession); 

我收到此錯誤連接mysql集羣。

https://dev.mysql.com/doc/ndbapi/en/ndb-nodejs-setup.html

Error: Cannot find module 'mysql-js' 

at Function.Module._resolveFilename (module.js:338:15) 

at Function.Module._load (module.js:280:25) 


if i try to install with npm install mysql-js i am getting below error 

npm http GET https://registry.npmjs.org/mysql-js 

npm http 404 https://registry.npmjs.org/mysql-js 

npm ERR! 404 'mysql-js' 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. 
+0

是「節點MySQL驅動程序」安裝在你的機器上? –

回答

0

您必須下載該模塊,你必須把它放在「node_modules」目錄。

0

您需要安裝mysql-js。 爲此,請轉到命令提示符並轉到您擁有該項目的根目錄。

npm install mysql-js 

然後運行該應用程序

node app.js //Assuming app.js is the your app file 
0

您應該安裝該模塊是這樣的:

npm install mysql/mysql-js 

npm是聰明Github上庫)

知道它是怎麼回事問一些與你的MySQL安裝有關的問題。