I am trying to use the web3 API through my project in meteor. I saw an example that included web3 the following way:

<script type="text/javascript">
var Web3 = require('web3');
var web3 = new Web3();
web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545"));
...code... </script>

When i run the project i get this error "Uncaught Error: Cannot find module 'web3'". I've already added web3 to meteor withe this command: meteor add ethereum:web3 . What am I missing?


2 Answers 2


I think this problem is to do with the version of web3 you have installed. Try installing with this version :

npm install ethereumjs-testrpc [email protected]
  • Hello, it was not because of the version but web3 overall. I adding some other stuff (it was long time ago i dont remember what) that messed up the installation. after installing again web3 it worked
    – PetrosM
    Sep 18, 2017 at 12:21

I found an answer to this that worked for me. Assuming your modules are in node_modules in your project directory and you're working with a file that's a sibling to that directory:

var Web3 = require('./web3');

If the files further down the file hierarchy, I assume a full path will work here as well, where ./ refers to project root

Your Answer

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

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