Ionic serve & build both stops mid way before building the app

If I run ionic serve I get:

[INFO] Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 - Ctrl+C to cancel
[19:56:35]  watch started ...
[19:56:35]  build dev started ...
[19:56:35]  Proxy added:/ => http://10.100.101.8:8083/
[19:56:35]  clean started ...
[19:56:35]  clean finished in 4 ms
[19:56:35]  copy started ...
[19:56:35]  transpile started ...
[19:56:39]  transpile finished in 4.17 s
[19:56:39]  preprocess started ...
[19:56:39]  deeplinks started ...
[19:56:39]  deeplinks finished in 237 ms
[19:56:39]  preprocess finished in 239 ms
[19:56:39]  webpack started ...
[19:56:40]  copy finished in 4.99 s

Then nothing, no files created no localhost started, nothing, it just stops.

  • This started out of no where while I was working today. The localhost stopped working and the serve or build command wont work.
  • I tried updating everything, uninstalling and reinstalling everything, nothing helped.
  • My other projects works normally.
  • www/build only contains polyfills.js & sw-toolbox.js

Here is my ionic info

cli packages: (E:\Ionic\workspace\mb\node_modules)

    @ionic/cli-utils  : 1.9.2
    ionic (Ionic CLI) : 3.9.2

global packages:

    Cordova CLI : 7.0.1

local packages:

    @ionic/app-scripts : 2.1.4
    Cordova Platforms  : android 6.2.3 ios 4.3.1
    Ionic Framework    : ionic-angular 3.6.0

System:

    Android SDK Tools : 26.0.2
    Node              : v6.11.2
    npm               : 5.4.0
    OS                : Windows 10

Run the same command with --verbose for more output.
Run npm run ionic:build --verbose for an another angle.

ionic serve --verbose Output:

[DEBUG] CLI flags: { interactive: true, confirm: false }
[DEBUG] { cwd: 'E:\\Ionic\\workspace\\mb', local: true, binPath:
        'C:\\Users\\iaboelsuod\\AppData\\Roaming\\npm\\node_modules\\ionic\\bin\\ionic', libPath:
        'E:\\Ionic\\workspace\\mb\\node_modules\\ionic\\dist\\index.js' }
[INFO] Starting app-scripts server: --address 0.0.0.0 --port 8100 --livereload-port 35729 - Ctrl+C to cancel
[20:15:49]  watch started ...
[20:15:49]  build dev started ...
[20:15:49]  Proxy added:/ => http://10.100.101.8:8083/
[20:15:49]  clean started ...
[20:15:49]  clean finished in 2 ms
[20:15:49]  copy started ...
[20:15:49]  transpile started ...
[20:15:53]  transpile finished in 3.87 s
[20:15:53]  preprocess started ...
[20:15:53]  deeplinks started ...
[20:15:53]  deeplinks finished in 231 ms
[20:15:53]  preprocess finished in 233 ms
[20:15:53]  webpack started ...
[20:15:53]  copy finished in 4.65 s

npm run ionic:build --verbose Output:

npm info it worked if it ends with ok
npm verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
npm verb cli   'C:\\Users\\iaboelsuod\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
npm verb cli   'run',
npm verb cli   'ionic:serve',
npm verb cli   '--verbose' ]
npm info using npm@5.4.0
npm info using node@v6.11.2
npm verb run-script [ 'preionic:serve', 'ionic:serve', 'postionic:serve' ]
npm info lifecycle FFS@0.0.1~preionic:serve: FFS@0.0.1
npm info lifecycle FFS@0.0.1~ionic:serve: FFS@0.0.1

> FFS@0.0.1 ionic:serve E:\Ionic\workspace\mb
> ionic-app-scripts serve

[20:17:19]  ionic-app-scripts 2.1.4
[20:17:19]  watch started ...
[20:17:19]  build dev started ...
[20:17:19]  Proxy added:/ => http://10.100.101.8:8083/
[20:17:19]  clean started ...
[20:17:19]  clean finished in 3 ms
[20:17:19]  copy started ...
[20:17:19]  transpile started ...
[20:17:23]  transpile finished in 4.01 s
[20:17:23]  preprocess started ...
[20:17:23]  deeplinks started ...
[20:17:23]  deeplinks finished in 201 ms
[20:17:23]  preprocess finished in 203 ms
[20:17:23]  webpack started ...
[20:17:24]  copy finished in 4.65 s
E:\Ionic\workspace\mb\node_modules\source-map\lib\source-node.js:115
        node.add(nextLine.substr(0, mapping.generatedColumn));
                         ^

TypeError: Cannot read property 'substr' of undefined
    at Function.<anonymous> (E:\Ionic\workspace\mb\node_modules\source-map\lib\source-node.js:115:26)
    at Array.forEach (native)
    at SourceMapConsumer_eachMapping [as eachMapping] (E:\Ionic\workspace\mb\node_modules\source-map\lib\source-map-consumer.js:155:14)
    at Function.SourceNode_fromStringWithSourceMap [as fromStringWithSourceMap] (E:\Ionic\workspace\mb\node_modules\source-map\lib\source-node.js:80
:24)
    at SourceMapSource.node (E:\Ionic\workspace\mb\node_modules\webpack-sources\lib\SourceMapSource.js:39:21)
    at ReplaceSource.node (E:\Ionic\workspace\mb\node_modules\webpack-sources\lib\ReplaceSource.js:70:30)
    at CachedSource.node (E:\Ionic\workspace\mb\node_modules\webpack-sources\lib\CachedSource.js:18:24)
    at E:\Ionic\workspace\mb\node_modules\webpack-sources\lib\ConcatSource.js:37:50
    at Array.map (native)
    at ConcatSource.node (E:\Ionic\workspace\mb\node_modules\webpack-sources\lib\ConcatSource.js:36:63)
npm verb lifecycle FFS@0.0.1~ionic:serve: unsafe-perm in lifecycle true
npm verb lifecycle FFS@0.0.1~ionic:serve: PATH: C:\Users\iaboelsuod\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;E:\Ionic\workspace\mBank
ing\node_modules\.bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\W
indowsPowerShell\v1.0\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Wind
ows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;F:\Android\SDK\tools;F:\Android\SDK\platform-tools;F:\Android\SDK\tools\bin
;C:\Program Files\Git\cmd;C:\Program Files\TortoiseSVN\bin ;C:\Program Files\nodejs\;C:\Maven\bin;C:\gradle-4.0\bin;C:\Program Files\Java\jdk1.8.0_131\bin
;;C:\Program Files\Microsoft VS Code\bin;C:\Users\iaboelsuod\AppData\Roaming\npm
npm verb lifecycle FFS@0.0.1~ionic:serve: CWD: E:\Ionic\workspace\mb
npm info lifecycle FFS@0.0.1~ionic:serve: Failed to exec ionic:serve script
npm verb stack Error: FFS@0.0.1 ionic:serve: `ionic-app-scripts serve`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (C:\Users\iaboelsuod\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:280:1
6)
npm verb stack     at emitTwo (events.js:106:13)
npm verb stack     at EventEmitter.emit (events.js:191:7)
npm verb stack     at ChildProcess.<anonymous> (C:\Users\iaboelsuod\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:5
5:14)
npm verb stack     at emitTwo (events.js:106:13)
npm verb stack     at ChildProcess.emit (events.js:191:7)
npm verb stack     at maybeClose (internal/child_process.js:891:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm verb pkgid FFS@0.0.1
npm verb cwd E:\Ionic\workspace\mb
npm verb Windows_NT 10.0.10240
npm verb argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\iaboelsuod\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "ioni
c:serve" "--verbose"
npm verb node v6.11.2
npm verb npm  v5.4.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! FFS@0.0.1 ionic:serve: `ionic-app-scripts serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the FFS@0.0.1 ionic:serve script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm verb exit [ 1, true ]

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\iaboelsuod\AppData\Roaming\npm-cache\_logs\2017-09-05T18_17_31_094Z-debug.log

I am guessing this is the error: Cannot read property 'substr' of undefined ?

I found the problem, one of my components had 2 .html files. It kinda was like 2 components in 1 so it had like a template and a child template. Removing the child template html file fixed the problem -I included the html in the .ts file instead.
This is a really weird problem. I know my structure does not really follow the standard but one would never guess it wont work, specially when there is no error message.
Thank you for your help.

1 Like

Yes, but not idea what it means.

Do you get this also with a new project created with ionic start blank blank?

You might want to create a Github issue for app-scripts and describe this problem. This should maybe be cought or at least output in a better way.

No. As I said in the post my other projects worked normally.

I am not very knowledgeable on how to do that, but I will try ^^

Just go here and add the information you descirbed above: https://github.com/ionic-team/ionic-app-scripts/issues/new

1 Like
1 Like