IBM-Cloud / dashdb-nodejs-helloworld

A Hello World example written in Node.js to help understand how to connect to Db2 Warehouse (on Cloud)
https://www.npmjs.com/package/ibm_db#api
Apache License 2.0
8 stars 21 forks source link

Module version mismatch. Expected 47, got 46. #1

Open prasanta303 opened 7 years ago

prasanta303 commented 7 years ago

Hello, After downloaded the source added dashGB service using command from cf command line. After adding the service, get the credentials and put in app.js. Install the npm modules. now on doing npm start or node app.js it's giving following error,

        throw e
        ^

Error: Module version mismatch. Expected 47, got 46.
    at Error (native)
    at Object.Module._extensions..node (module.js:440:18)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at bindings (C:\Prasanta\Official\IBM\IDEA\NBA\dashdb-nodejs-helloworld-mast
er\dashdb-nodejs-helloworld-master\node_modules\bindings\bindings.js:74:15)
    at Object.<anonymous> (C:\Prasanta\Official\IBM\IDEA\NBA\dashdb-nodejs-hello
world-master\dashdb-nodejs-helloworld-master\node_modules\ibm_db\lib\odbc.js:27:
31)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

Please let me know how to resolve the issue while running it in local.

prsahoo commented 7 years ago

Hi @prasanta303 , I hope you are on Windows. This issue is fixed in ibm_db version 1.0.2. Can you please modify your package.json to include the latest version and try again. "ibm_db": "1.0.2", Please let me know how it goes. Thank you.

prasanta303 commented 7 years ago

Hi @prsahoo, Yes, I am on Windows. I have modified my package.json as per your advice. Even if, I am getting same kind of issue but have different version mismatch as below,

C:\Prasanta\Official\IBM\IDEA\NBA\dashdb-nodejs-helloworld-master\dashdb-nodejs-
helloworld-master\node_modules\bindings\bindings.js:83
        throw e
        ^

Error: Module version mismatch. Expected 47, got 48.
    at Error (native)
    at Object.Module._extensions..node (module.js:440:18)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at bindings (C:\Prasanta\Official\IBM\IDEA\NBA\dashdb-nodejs-helloworld-mast
er\dashdb-nodejs-helloworld-master\node_modules\bindings\bindings.js:76:44)
    at Object.<anonymous> (C:\Prasanta\Official\IBM\IDEA\NBA\dashdb-nodejs-hello
world-master\dashdb-nodejs-helloworld-master\node_modules\ibm_db\lib\odbc.js:27:
31)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)

Please help me out.

DaithiOCiaran commented 7 years ago

@prasanta303 I managed to get this to work - I changed the Package file - Jade was deprecated and you need Pug "dependencies": { "cf-deployment-tracker-client": "0.0.8", "express": "3.5.x", "ibm_db": "1.0.2", "pug": "2.0.0-beta11" }, Refresh your package file and rerun npm install.

Not sure it's relevant but I also updated the Manifest File to have my own unique host variable below with your own unique one

sam-github commented 7 years ago

Error: Module version mismatch. Expected 47, got 46.

This is because you installed your dependencies with one node version, and are requiring them with another node version.

47 is node 5.x and 46 is node 4.x, FYI: node -p process.versions.modules will tell you the ABI number for your node.