Ionic-app-scripts: Error: app-scripts serve unexpectedly failed.

Created on 10 May 2017  路  6Comments  路  Source: ionic-team/ionic-app-scripts

Short description of the problem:

Been wrestling with Ionic CLI 3 for hours, both in existing and new projects. npm run build works. ionic serve does not.
Error message:
[DEBUG] !!! ERROR ENCOUNTERED !!!
Error: app-scripts serve unexpectedly failed.
[DEBUG] Error: app-scripts serve unexpectedly failed.
at Object. (C:\Users\Aaron\IonicDevelop\ActionSearchnode_modules\@ionic\cli-plugin-ionic-angular\dist\serve.js:50:19)
at Generator.next ()
at fulfilled (C:\Users\Aaron\IonicDevelop\ActionSearchnode_modules\@ionic\cli-plugin-ionic-angular\dist\serve.js:4:58)

What behavior are you expecting?

For ionic serve to work.

Steps to reproduce:

  1. Create new project
  2. Install package.json and other libraries as explained below
  3. Run ionic serve, or ionic serve --verbose
insert any relevant code between the above and below backticks

In addition to below package.,json, I am also using npm libraries uuid and reselect.
package.json:
{
"name": "ActionSearch",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/common": "4.0.2",
"@angular/compiler": "4.0.2",
"@angular/compiler-cli": "4.0.2",
"@angular/core": "4.0.2",
"@angular/forms": "4.0.2",
"@angular/http": "4.0.2",
"@angular/platform-browser": "4.0.2",
"@angular/platform-browser-dynamic": "4.0.2",
"@ionic-native/call-number": "^3.7.0",
"@ionic-native/core": "3.6.1",
"@ionic-native/in-app-browser": "^3.7.0",
"@ionic-native/splash-screen": "3.6.1",
"@ionic-native/status-bar": "3.6.1",
"@ionic/storage": "2.0.1",
"@ngrx/core": "^1.2.0",
"@ngrx/store": "^2.2.2",
"angularfire2": "^4.0.0-rc.0",
"firebase": "^3.9.0",
"ionic-angular": "3.1.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.10"
},
"devDependencies": {
"@ionic/app-scripts": "1.3.7",
"@ionic/cli-plugin-cordova": "1.0.0",
"@ionic/cli-plugin-ionic-angular": "1.0.0",
"typescript": "~2.2.1"
},
"description": "An Ionic project"
}

Which @ionic/app-scripts version are you using?
1.3.7

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
tsconfig.json
{
"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
}
}

Most helpful comment

I have the same problem and I tried with node 6 and 7. It doesnt work either way. Also I am not using nvm.

All 6 comments

Forgot to include ionic info:

global packages:

@ionic/cli-utils : 1.0.0
Cordova CLI      : 7.0.0
Ionic CLI        : 3.0.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.0.0
@ionic/cli-plugin-ionic-angular : 1.0.0
Ionic Framework                 : ionic-angular 3.1.1

System:

Node       : v7.10.0
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed

I tested successfully on Win10, but only with Node v6.x - as you are also using nvm, maybe try again with a 6.x to see if this is related.

I have the same problem and I tried with node 6 and 7. It doesnt work either way. Also I am not using nvm.

I had the same problem
You probably don't have one of these files/directory :

./src/assets/**/*, 
./src/index.html, 
./src/manifest.json, 
./src/service-worker.js, 
./node_modules/ionicons/dist/fonts/**/*, 
./node_modules/ionic-angular/fonts/**/*, 
./node_modules/ionic-angular/polyfills/polyfills.js, 
./node_modules/sw-toolbox/sw-toolbox.js

In my case I didn't have the directory ./src/assets


More detail
With debug I found this catched log

Error: A watch configured to watch the following paths failed to start. It likely that a file referenced does not exist: ./src/assets/**/*, ./src/index.html, ./src/manifest.json, ./src/service-worker.js, ./node_modules/ionicons/dist/fonts/**/*, ./node_modules/ionic-angular/fonts/**/*, ./node_modules/ionic-angular/polyfills/polyfills.js, ./node_modules/sw-toolbox/sw-toolbox.js
    at new BuildError (./node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
    at Timeout._onTimeout (./node_modules/@ionic/app-scripts/dist/watch.js:71:20)
    at ontimeout (timers.js:386:14)
    at tryOnTimeout (timers.js:250:5)
    at Timer.listOnTimeout (timers.js:214:5)

or you can also change the watch configuration

Thanks for your in-depth comment @bmedy. The cli team tagged this as a bug and put its resolution into the milestones for cli version 3.1.0, see here.

@Aaron-Sterling would you please provide me with the solution

Was this page helpful?
0 / 5 - 0 ratings