1

I've been following Dapp University's videos on how to make IPFS uploads with Euthereum Smart contracts, and after I manage to 'npm run start' in the command line it opens up the HTML, but it always gives me this error: 'No web3 instance injected, using local web3.'

enter image description here

Here is the link to the first video: https://www.youtube.com/watch?v=SkMH0WeRYtg&t=1s

And here is the link to his code: https://github.com/dappuniversity/ipfs_image_uploader

I have a suspicion that the issue might lie within the getWeb3.js file, but maybe you had the same issue and know how to complete the tutorial, in any case, I would really appreciate your help!

This is the code of the getWeb3.js file :

import Web3 from 'web3'

let getWeb3 = new Promise(function(resolve, reject) { // Wait for loading completion to avoid race conditions with web3 injection timing. window.addEventListener('load', function() { var results var web3 = window.web3

// Checking if Web3 has been injected by the browser (Mist/MetaMask)
if (typeof window.web3 !== 'undefined') {
  // Use Mist/MetaMask's provider.
  web3 = new Web3(window.web3.currentProvider)

  results = {
    web3: web3
  }

  console.log('Injected web3 detected.');

  resolve(results)
} else {
  // Fallback to localhost if no web3 injection. We've configured this to
  // use the development console's port by default.
  var provider = new Web3.providers.HttpProvider('http://127.0.0.1:9545')

  web3 = new Web3(provider)

  results = {
    web3: web3
  }

  console.log('No web3 instance injected, using Local web3.');

  resolve(results)
}

1 Answer 1

1

// Checking if Web3 has been injected by the browser (Mist/MetaMask)

You need to install the MetaMask extension

2
  • I have the metamask extension for google chrome
    – anthonyacc
    May 20, 2019 at 10:10
  • 1
    Then you will need to enable it (turn privacy off), because MetaMask is in privacy mode by default
    – KNK
    May 20, 2019 at 10:21

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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