Uncaught ReferenceError: require is not defined in Meteor

I am trying to deploy my project which needs the web3 Javascript API. As done by some examples I found online, I need to do the following:

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 ReferenceError: require is not defined". I've already done "meteor add modules", meteor add aramk:requirejs, sudo npm install require and sudo npm install requirejs. I downloaded and included the js file (through templating since in meteor js files are handled differently). What am I missing?

Maybe try using es6 imports?

Since I code in Coffee-Script I am using require all the time and I didn’t do anything special to get that to work. Have you tried meteor add ecmascript ? I think that should do it.

Yes I had already added ecmascript. I added a whole bunch of packages and probably that was the cause of the error. I created another folder added just the necessary imports/packages/scripts and it worked. Thank you