title: twilio error 'username required'
body: <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var express = require('express');
  var router = express.Router();
  var bodyParser = require('body-parser');
  var nodemailer = require('nodemailer');
  var TWILIO_TOKEN = "270ff32fe16828869dc30e0c6926fa9e";
  var client = require('twilio')(process.env.AC55a59221acb23a5aa6f046740bb73317, process.env.TWILIO_TOKEN);
  router.use(bodyParser.urlencoded({extended: true}));
  router.use(bodyParser.json());
  
  router.post('/', function(req, res) {
      console.log('this is the req', req.body);
      client.messages.creat({
          to:'+19522209630',
          from:'+17633249718',
          body:'hello World'
      }, function(err, data) {
          if (err) {
              console.log('err', err);
              console.log('data', data);
          }
      });//en d of sendMessage
      res.send(200);
  });
  
  module.exports = router;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>/Users/moisesmiguelhernandez/Documents/prime/solo_project/node_modules/twilio/lib/rest/Twilio.js:101
      throw new Error('username is required');
      ^
  
  Error: username is required
      at new Twilio (/Users/moisesmiguelhernandez/Documents/prime/solo_project/node_modules/twilio/lib/rest/Twilio.js:101:11)
      at initializer (/Users/moisesmiguelhernandez/Documents/prime/solo_project/node_modules/twilio/lib/index.js:8:10)
      at Object.&lt;anonymous&gt; (/Users/moisesmiguelhernandez/Documents/prime/solo_project/routes/sendMessage.js:6:31)
      at Module._compile (module.js:569:30)
      at Object.Module._extensions..js (module.js:580:10)
      at Module.load (module.js:503:32)
      at tryModuleLoad (module.js:466:12)
      at Function.Module._load (module.js:458:3)
      at Module.require (module.js:513:17)
      at require (internal/module.js:11:18)
      at Object.&lt;anonymous&gt; (/Users/moisesmiguelhernandez/Documents/prime/solo_project/server.js:10:19)
      at Module._compile (module.js:569:30)
      at Object.Module._extensions..js (module.js:580:10)
      at Module.load (module.js:503:32)
      at tryModuleLoad (module.js:466:12)
      at Function.Module._load (module.js:458:3)
  npm ERR! code ELIFECYCLE
  npm ERR! errno 1
  npm ERR! solo_project@1.0.0 start: `node server.js`
  npm ERR! Exit status 1
  npm ERR! 
  npm ERR! Failed at the solo_project@1.0.0 start script.
  npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /Users/moisesmiguelhernandez/.npm/_logs/2017-07-11T15_02_02_750Z-debug.log</code></pre>
  </div>
  </div>
  </p>
  
  <p>I am getting and error that says username is required. I am trying to use twilio. I followed a youtube video and i have it like he does. Any suggestions on how to fix this? P.S The index file is the terminal error message</p>