title: How to properly register plugins in Hapi.js
body: <p>I followed hapi's official website and tried a simple server, but failed: I cannot register plugins, </p>
  
  <pre><code>var Hapi = require('hapi');
  
  var server = new Hapi.Server();
  
  server.connection({port: 4004});
  
  server.register([require('inert'), require('vision')], (err) =&gt; {
      if (err) {
          throw err;
      }
  
      server.start(err =&gt; {
          console.log('server started');
      });
  });
  </code></pre>
  
  <p>It is throwing foollowing error:</p>
  
  <pre><code>/Users/apple/Documents/node_projects/hapijon/testjon/ch4_routes_and_handlers/node_modules/hapi/lib/plugin.js:219
          if (plugin.register.register) {                             // Required plugin
                              ^
  
  TypeError: Cannot read property 'register' of undefined
      at module.exports.internals.Server.internals.Plugin.register (/Users/apple/Documents/node_projects/hapijon/testjon/ch4_routes_and_handlers/node_modules/hapi/lib/plugin.js:219:29)
      at Object.&lt;anonymous&gt; (/Users/apple/Documents/node_projects/hapijon/testjon/ch4_routes_and_handlers/tess.js:7:8)
      at Module._compile (module.js:635:30)
      at Object.Module._extensions..js (module.js:646:10)
      at Module.load (module.js:554:32)
      at tryModuleLoad (module.js:497:12)
      at Function.Module._load (module.js:489:3)
      at Function.Module.runMain (module.js:676:10)
      at startup (bootstrap_node.js:187:16)
      at bootstrap_node.js:608:3
  </code></pre>
  
  <p>Here is my package.json:</p>
  
  <pre><code>  "dependencies": {
      "accept": "^2.1.4",
      "hapi": "^14.2.0",
      "inert": "^5.0.1",
      "iron": "^5.0.4",
      "vision": "^5.3.0",
      "wreck": "^14.0.2"
    }
  </code></pre>