title: TypeError: Cannot read property 'substr' of undefined - source-node.js
body: <p>This error comes as a result of resolving <a href="https://stackoverflow.com/questions/41893245/upgrading-to-ionic-v2-0-0-issues">this question</a></p>
  
  <p>Here is my <code>ionic info</code>:</p>
  
  <pre><code>Cordova CLI: 6.5.0
  Ionic Framework Version: 2.0.0
  Ionic CLI Version: 2.2.1
  Ionic App Lib Version: 2.2.0
  Ionic App Scripts Version: 1.0.0
  ios-deploy version: Not installed
  ios-sim version: Not installed
  OS: Windows 10
  Node Version: v7.4.0
  Xcode version: Not installed
  </code></pre>
  
  <p><em>(I am also using npm <code>v4.1.1</code>)</em></p>
  
  <p>When attempting to build <code>@ionic/app-scripts</code>, I am getting the following error:</p>
  
  <pre><code>E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\node_modules\source-map\lib\source-node.js:95
        var code = nextLine.substr(0, mapping.generatedColumn -
                           ^
  
  TypeError: Cannot read property 'substr' of undefined
      at Function.&lt;anonymous&gt; (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\node_modules\source-map\lib\source-node.js:95:30)
      at Array.forEach (native)
      at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\node_modules\source-map\lib\source-map-consumer.js:155:14)
      at Function.SourceNode_fromStringWithSourceMap [as fromStringWithSourceMap] (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\node_modules\source-map\lib\source-node.js:80:24)
      at SourceMapSource.node (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\SourceMapSource.js:42:20)
      at ReplaceSource.node (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\ReplaceSource.js:69:29)
      at CachedSource.node (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\CachedSource.js:12:23)
      at E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\ConcatSource.js:40:49
      at Array.map (native)
      at ConcatSource.node (E:\Documents\Year_3\Mobile_Application_Development\mammoth-v2\node_modules\webpack-sources\lib\ConcatSource.js:39:60)
  </code></pre>
  
  <p>If needed, when I run <code>npm run build</code> <em>(to build <code>@ionic/app-scripts</code>)</em>, this is the build log:</p>
  
  <pre><code>[07:28:45]  ionic-app-scripts 1.0.0 
  [07:28:45]  build dev started ...
  [07:28:45]  clean started ...
  [07:28:45]  clean finished in 4 ms
  [07:28:45]  copy started ...
  [07:28:45]  transpile started ...
  [07:28:49]  transpile finished in 4.44 s
  [07:28:49]  webpack started ...
  [07:28:49]  copy finished in 4.57 s
  
              **errors arise here**
  </code></pre>
  
  <p><strong>EDIT:</strong></p>
  
  <p>I added the configuration: </p>
  
  <pre><code>"config": {
      "ionic_generate_source_map": false
  },
  </code></pre>
  
  <p>...to <code>packages.json</code> which seemed to fix the error but am now faced with another one:</p>
  
  <blockquote>
    <p><code>Error: ENOENT: no such file or directory, open 'main.js.map'</code></p>
  </blockquote>
  
  <p>Which is thrown when I attempt to do <code>ionic serve</code> <em>(the build of <code>@ionic/app-scripts</code> works just fine now)</em></p>
  
  <p><strong>EDIT #2:</strong></p>
  
  <p>Does <code>ionic</code> rely on a source map to run? As the error is arising because non are built</p>