title: Typescript Error Cannot find name 'require'. IONIC 3
body: <p>Typescript Error
  Cannot find name 'require'.
  C:/Users/me/project/src/pages/home/home.ts
              // require the Twilio module and create a REST client</p>
  
  <p>const client = require('twilio')(accountSid, authToken);</p>
  
  <p>Ionic Framework: 3.3.0</p>
  
  <p>Ionic App Scripts: 1.3.7</p>
  
  <p>Angular Core: 4.1.2</p>
  
  <p>Angular Compiler CLI: 4.1.2</p>
  
  <p>Node: 6.10.3</p>
  
  <p>OS Platform: Windows 10</p>
  
  <p>Navigator Platform: Win32</p>
  
  <p>User Agent: Mozilla/5.0 (Windows NT 10.0; Win64;</p>
  
  <p><a href="https://i.stack.imgur.com/gPaCd.png" rel="nofollow noreferrer">ts code</a></p>
  
  <p>CODE inside home.ts:</p>
  
  <p>TOP</p>
  
  <pre><code>import { Component } from '@angular/core';
  import { FirebaseProvider } from './../../providers/firebase/firebase';
  import { FirebaseListObservable } from 'angularfire2/database';
  import { NavController, NavParams } from 'ionic-angular';
  import { BarcodeScanner ,BarcodeScannerOptions } from '@ionic-native/barcode-scanner';
  import { Request } from '@angular/http';
  
  
  @Component({
  selector: 'home',
  templateUrl: 'home.html',
  })
  </code></pre>
  
  <p>//ALERT FUNCTION</p>
  
  <pre><code>scanAlert(){
      this.options = {
        showFlipCameraButton : true,
        formats : "QR_CODE,PDF_417", 
        prompt : "SCAN QR CODE "
      }
      this.barcodeScanner.scan(this.options).then((barcodeData) =&gt; {
          console.log(barcodeData);
          this.pinText = barcodeData.text;
          const uid = this.pinText;
          this.firebaseProvider.afd.database.ref('pins')
          .orderByChild('QRCODE')
          .equalTo(uid)
          .limitToFirst(1)
          .once('value', snap =&gt; {
              let key = Object.keys(snap.val())[0]; // KEY VALUE 
              let user = snap.child(key).val(); // the whole user object
              this.message = 'Parameters to send to twilio' + user.phone + 
                    'regarding'+user.message;
  
              const accountSid = 'myacctid';
              const authToken = 'mytoken';
  
              // require the Twilio module and create a REST client
              const client = require('twilio')(accountSid, authToken);
  
              client.messages
              .create({
                  to: '+142mynumber  ',
                  from: '+mysms trial#',
                  body: 'TEST Alert Message !',
    })
    .then((message) =&gt; console.log(message.sid));
  </code></pre>
  
  <p>I followed these steps </p>
  
  <p>install require --save</p>
  
  <p>and </p>
  
  <p>npm install @types/node --save-dev</p>
  
  <p>My issue is that the message does not get sent.</p>
  
  <p>if i add </p>
  
  <pre><code>declare var require: any    
  </code></pre>
  
  <p>the error goes away, but twilio never gets the request to send the message.
  <a href="https://i.stack.imgur.com/lZEsP.png" rel="nofollow noreferrer">enter image description here</a></p>
  
  <p>I cannot find any tutorials for Ionic3 or Angular and twilio to send an sms
  I have not even passed the parameters, I copied the </p>
  
  <p>I also tried this</p>
  
  <pre><code>    var twilio = require('twilio');//Make sure to npm install @types/node
      var accountSid = 'myacctid'; // Your Account SID from www.twilio.com/console
      var authToken = 'myauthtoken';   // Your Auth Token from www.twilio.com/console
  
  
      var client = new twilio(accountSid, authToken);
  
      client.messages.create({
          body: 'ALERT! Someone has scanned the Alert Code for ',
          to: '+myphone'  ,// Text this number
          from: '+myTwilioTrial#' // From a valid Twilio number
      })
      .then((message) =&gt; console.log(message.sid));
  </code></pre>
  
  <p>my tsconfig.json:</p>
  
  <pre><code>{
    "compilerOptions": {
      "allowSyntheticDefaultImports": true,
      "declaration": false,
      "emitDecoratorMetadata": true,
      "experimentalDecorators": true,
      "lib": [
        "dom",
        "es2015"
      ],
      "module": "es2015",
      "moduleResolution": "node",
      "sourceMap": true,
      "target": "es5"
    },
    "include": [
      "src/**/*.ts"
    ],
    "exclude": [
      "node_modules"
    ],
    "compileOnSave": false,
    "atom": {
      "rewriteTsconfig": false
    }
  }
  </code></pre>