I'm trying to send a signed transaction from a web interface using web3, web3 is loaded and I'm connected to an Infuro.io node. Ethereumjs-tx is installed and I've also included it as seperate JS, but whatever I do I keep getting the error message 'Cannot find module ethereumjs-tx'

Really a loss as to what to do, it's clearly in the node_modules folder as well as being loaded as a seperate script. How can the module not be found?

  web3 = new Web3(new Web3.providers.HttpProvider("<TOKEN>"));
          var tokenContract = web3.eth.contract(human_standard_token_abi);
          var tokenRunning = tokenContract.at('0x5780a5928becc986edd597991a1a1af6357fdf05');
          console.log('Balance is equal to ' + tokenRunning.balanceOf('" . $ETH_ADDRESS . "').toNumber() + ' tokens');

          var Tx = require('ethereumjs-tx');
          var privateKey = new Buffer.from('42d14f44661a68167622a3200f3a2555665b2f4f4d0e4f0e8ce878c0c3d6e6bf','hex')

          var rawTx = {
            nonce: '0x00',
            gasPrice: '0x09184e72a000',
            gasLimit: '0x2710',
            to: '0x0Cf9Dd61389Be41CD620C99579B6Ff1A8Be3B3fb',
            value: '20',
            data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057'

          var tx = new Tx(rawTx);

          var serializedTx = tx.serialize();


          web3.eth.sendRawTransaction(serializedTx.toString('hex'), function(err, hash) {
            if (!err)

Can it be the CDN of Web3 I'm using? Is there a CDN to include ethereumjs-tx?

The CDN I'm using is loaded like this

  <script src="https://cdn.jsdelivr.net/npm/web3@0.20.1/dist/web3.min.js"></script>
  • thanks, will get going with that. Think this is the answer. – DCKTF May 25 '18 at 2:07

Browse other questions tagged or ask your own question.