0

I am trying to connect mysql cluster with node js

My program

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

var dbProperties = {

    "implementation" : "ndb",

    "database" : "users"

};

nosql.openSession(dbProperties, null, onSession);

I am getting this error.

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.
robertklep
  • 198,204
  • 35
  • 394
  • 381
ohm
  • 140
  • 1
  • 5

4 Answers4

0

You have to download that module and you have to put it in "node_modules" directory.

Paresh Thummar
  • 933
  • 7
  • 20
0

You would need to install mysql-js. For that go to command prompt and go root directory where you have the project.

npm install mysql-js

then run the app

node app.js //Assuming app.js is the your app file
Neo
  • 4,550
  • 6
  • 34
  • 51
0

You should install that module like this:

npm install mysql/mysql-js

(npm is smart about Github repositories)

Be aware that it's going to ask some questions related to your MySQL installation.

robertklep
  • 198,204
  • 35
  • 394
  • 381
0

You need to be using the node.js driver software that comes as part of MySQL Cluster - you can see a worked tutorial in this post:
Using JavaScript and Node.js with MySQL Cluster – First steps

luchaninov
  • 6,792
  • 6
  • 60
  • 75
Andrew Morgan
  • 560
  • 3
  • 5