title: Getting "TypeError: Cannot read property 'filename' of undefined" when calling `npm start`
body: <p>I am following <a href="https://www.smashingmagazine.com/2016/03/server-side-rendering-react-node-express/" rel="nofollow">this quite lengthy but very informative post</a> about setting up a web application using the following technology stack:</p>
  
  <ul>
  <li>es 6</li>
  <li>node + express </li>
  <li>handlebars </li>
  <li>react + react router</li>
  <li>webpack + babel</li>
  </ul>
  
  <p>The sample code can be found <a href="https://github.com/zen-js-code/react-universal-web-apps/tree/simple" rel="nofollow">here</a>.</p>
  
  <p>I have been following along and it went quite well, I did understand the most important concepts. However, I am getting an error when I am trying to run it (after I downloaded it using <code>git clone</code>) like so:</p>
  
  <pre><code>$ npm install
  $ npm start
  </code></pre>
  
  <p>The generated output including the error is:</p>
  
  <pre><code>&gt; react-ssr-example@0.0.1 start /Users/nburk/Developer/node/templates/react-universal-web-apps-simple
  &gt; npm-run-all --parallel gulp server
  
  
  &gt; react-ssr-example@0.0.1 server /Users/nburk/Developer/node/templates/react-universal-web-apps-simple
  &gt; node-dev app/babel-server.js
  
  
  &gt; react-ssr-example@0.0.1 gulp /Users/nburk/Developer/node/templates/react-universal-web-apps-simple
  &gt; gulp
  
  [19:10:39] Using gulpfile ~/Developer/node/templates/react-universal-web-apps-simple/gulpfile.js
  [19:10:39] Starting 'build:scss'...
  [19:10:39] Starting 'build:watch:app'...
  TypeError: Cannot read property 'filename' of undefined
      at Object.obj.(anonymous function) [as runInThisContext] (/Users/nburk/Developer/node/templates/react-universal-web-apps-simple/node_modules/node-dev/lib/hook.js:25:55)
      at Object.&lt;anonymous&gt; (/Users/nburk/Developer/node/templates/react-universal-web-apps-simple/node_modules/graceful-fs/fs.js:10:13)
      at Module._compile (module.js:425:26)
      at Module._extensions..js (module.js:432:10)
      at nodeDevHook (/Users/nburk/Developer/node/templates/react-universal-web-apps-simple/node_modules/node-dev/lib/hook.js:58:7)
      at require.extensions.(anonymous function) (/Users/nburk/Developer/node/templates/react-universal-web-apps-simple/node_modules/babel-core/lib/api/register/node.js:214:7)
      at Object.nodeDevHook [as .js] (/Users/nburk/Developer/node/templates/react-universal-web-apps-simple/node_modules/node-dev/lib/hook.js:58:7)
      at Module.load (module.js:356:32)
      at Function.Module._load (module.js:311:12)
      at Module.require (module.js:366:17)
      at require (module.js:385:17)
  [19:10:39] Finished 'build:watch:app' after 12 ms
  [19:10:39] Starting 'lint:app'...
  [ERROR] 19:10:39 TypeError
  [19:10:39] Starting 'server'...
  </code></pre>
  
  <p>Does anyone see what I am missing? I have no clue where even to start, the filenames in the error don't really tell me anything...</p>
  
  <h3>Update</h3>
  
  <p>I checked for the file where the error occurs (<code>/node_modules/node-dev/lib/hook.js</code>), here's the code that causes it:</p>
  
  <pre><code>/**
   * Patch the specified method to watch the file at the given argument
   * index.
   */
   function patch(obj, method, optionsArgIndex) {
    var orig = obj[method];
    if (!orig) return;
    obj[method] = function () {
      var opts = arguments[optionsArgIndex];
      var file = typeof opts == 'string' ? opts : opts.filename;
      if (file) callback(file);
      return orig.apply(this, arguments);
    };
  }
  </code></pre>