0
$ npm show web3

web3@1.2.5-rc.0 | LGPL-3.0 | deps: 8 | versions: 115
Ethereum JavaScript API
https://github.com/ethereum/web3.js#readme
...
$ node app/test.js 
VERSION { api: '0.18.4',
  node: [Getter],
  getNode: { [Function: get] request: [Function: bound ] },
  network: [Getter],
  getNetwork: { [Function: get] request: [Function: bound ] },
  ethereum: [Getter],
  getEthereum: { [Function: get] request: [Function: bound ] },
  whisper: [Getter],
  getWhisper: { [Function: get] request: [Function: bound ] } 

Here is app/test.js:

let web3js = require("web3")

let web3 = new web3js(new web3js.providers.HttpProvider('http://localhost:8545'));

console.log("VERSION", web3.version)

Why do two different tests (run in the same directory) show two different versions of web3.js: 1.2.5-rc.0 and 0.18.4?!

  • Node allows to have multiple version of the same package. How your package.json looks like? – Ismael Jan 21 at 14:03
0

I think,

$ npm show web3 

this command shows the version of web3 globally installed on your system.

let web3js = require("web3")

let web3 = new web3js(new web3js.providers.HttpProvider('http://localhost:8545'));

console.log("VERSION", web3.version)

this shows the locally installed version of web3 in your current project.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.