Script error for "web3"

NosykaaNosykaa Member Posts: 4
Hi everyone,

I'm testing the web3 api, but it seems to be an error when I try require('web3'). Require.js indicates that there is an error inside web3.js
But I have the lattest release of web3.js
Maybe I have a wrong use of it. Can you help me ?

You can find bellow my code and the error.



Thank you for your help

Comments

  • maxxflyermaxxflyer Member Posts: 30
    did you find the answer? I can't have it working too..
  • MilkyWayzMilkyWayz Member Posts: 15
    The var web3 = new Web3() seems too much.
    Same error if you try ?
      var Web3 = require('web3');
    
      if(typeof web3 !== 'undefined'){
        web3 = new Web3(web3.currentProvider);
        console.log('Connected with Mist');
      } else {
        web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
        console.log('Connected on localhost:8585');
      }
Sign In or Register to comment.