App-scripts serve unexpectedly failed.settings: undefinedcontext: [object Object]

I had an issue with Ionic native not working on the browser (ionic serve) and one suggestion was that I delete the node_modules folder and run npm install. After doing this, I have the error:
[ERROR] app-scripts serve unexpectedly failed.settings: undefinedcontext: [object Object] and execution appears to exit back to the prompt but immediately shows

(node:4860) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: channel closed
(node:4860) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

No idea what’s causing this and what settings it’s looking for. I’d appreciate any assistance.

My setup is as below

ionic info

global packages:

@ionic/cli-utils : 1.1.1
Cordova CLI      : 7.0.1 
Ionic CLI        : 3.1.1

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.1.1
@ionic/cli-plugin-ionic-angular : 1.1.1
Ionic Framework                 : ionic-angular 3.2.1


Node       : v7.6.0
OS         : Linux 4.8
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed



I have the same Problem

had the same rm -rf node_modules and then npm install solved it for me.

1 Like

I have the same problem, I have not yet found a solution, rm node_modules and install it did not help

FWIW, even brand a new project does the same thing. I also updated the cli
and that didn’t make a difference.

this helped me.
Thank You

1 Like

In the absence of a way forward, I commented out the if block that throws this error and that has let me continue working. It will be overwritten when an update becomes available.

if (!settings) {
            throw new cli_utils_1.FatalException(`app-scripts serve unexpectedly failed.` +
                `settings: ${settings}` +
                `context: ${context}`);
1 Like

It seems that the problem occurs when we have custom config in package.json.
In my case removing from package.json:

"config": {
  "ionic_copy": "./config/copy.config.js"

The project runs normally, just can not figure out how to run with my custom ionic_copy.

Anyone have any suggestions?

I discovered the cause of my problem, it was not the ionic_copy statement, but the ionic_copy content, which had an item like the following:

copyBootstrapGrid: {
    src: ['{{ROOT}}/node_modules/bootstrap/dist/css/bootstrap-grid.min.css'],
    dest: '{{BUILD}}'

But the path '{{ROOT}}/node_modules/bootstrap/dist/css/bootstrap-grid.min.css' no longer exists in my directory, since I stopped using the bootstrap grid and removed it from package.json, and this error happened after removing all my node_modules directory and reinstalling for a dependency update. Moving to no longer contain this file in node_modules.

See if this helps you to identify your issues.

1 Like

Got the same issue, I my case the workaround by removing/commenting the following script on copy.config.js:

copySwToolbox: {
src: [’{{ROOT}}/node_modules/sw-toolbox/sw-toolbox.js’],
dest: ‘{{BUILD}}’

Same Error for me. And Nothing do this works.

Same problem here. The bug is at ionic cli i think. I installed a previous version with:

npm install -g ionic@2.1.18

and that worked for me.

I currently develop my app with “ionic serve”, without any errors.

I have the same problem anyone found a solution?

[ERROR] app-scripts serve unexpectedly failed.settings: undefinedcontext: [object Object]

Why didn’t you just go to 2.2.3?

Should I downgrade ionic too @rapropos?

Why don’t you post your package.json first?

  "name": "MyCompany",
  "author": "MyCompany",
  "homepage": "",
  "private": true,
  "scripts": {
    "clean": "ionic-app-scripts clean",
    "build": "ionic-app-scripts build",
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  "dependencies": {
    "@angular/animations": "4.1.0",
    "@angular/common": "4.1.0",
    "@angular/compiler": "4.1.0",
    "@angular/compiler-cli": "4.1.0",
    "@angular/core": "4.1.0",
    "@angular/forms": "4.1.0",
    "@angular/http": "4.1.0",
    "@angular/platform-browser": "4.1.0",
    "@angular/platform-browser-dynamic": "4.1.0",
    "@angular/platform-server": "4.1.0",
    "@ionic-native/camera": "3.6.1",
    "@ionic-native/core": "3.6.1",
    "@ionic-native/device": "3.6.1",
    "@ionic-native/geolocation": "^3.6.1",
    "@ionic-native/image-picker": "3.6.1",
    "@ionic-native/keyboard": "^3.6.1",
    "@ionic-native/splash-screen": "3.6.1",
    "@ionic-native/status-bar": "3.6.1",
    "@ionic-native/transfer": "3.6.1",
    "@ionic/cloud-angular": "^0.12.0",
    "@ionic/storage": "2.0.1",
    "@types/lodash": "^4.14.37",
    "angular2-moment": "^1.0.0",
    "angular2-virtual-scroll": "0.1.5",
    "com.synconset.imagepicker": "",
    "cordova-android": "^6.2.3",
    "cordova-imagePicker": "git+",
    "cordova-ios": "^4.4.0",
    "cordova-plugin-camera": "~2.3.1",
    "cordova-plugin-console": "~1.0.4",
    "cordova-plugin-crosswalk-webview": "^2.2.0",
    "cordova-plugin-device": "~1.1.3",
    "cordova-plugin-fcm": "~1.1.5",
    "cordova-plugin-file": "~4.3.1",
    "cordova-plugin-file-transfer": "~1.6.1",
    "cordova-plugin-geolocation": "~2.4.1",
    "cordova-plugin-media": "~2.4.1",
    "cordova-plugin-splashscreen": "",
    "cordova-plugin-statusbar": "~2.2.1",
    "cordova-plugin-whitelist": "~1.3.0",
    "cordova-sqlite-storage": "~2.0.0",
    "google-maps": "^3.2.1",
    "immutable": "^3.8.1",
    "ionic-angular": "3.2.1",
    "ionic-plugin-keyboard": "~2.2.1",
    "ionicons": "3.0.0",
    "jquery": "^3.1.1",
    "moment": "^2.18.1",
    "moment-range": "^3.0.3",
    "moment-timezone": "^0.5.11",
    "ng2-translate": "^5.0.0",
    "rxjs": "5.3.0",
    "sw-toolbox": "3.6.0",
    "tslint": "^5.2.0",
    "typescript": "^2.3.2",
    "underscore": "^1.8.3",
    "zone.js": "0.8.10"
  "devDependencies": {
    "@ionic/app-scripts": "^1.3.7",
    "@ionic/cli-plugin-cordova": "^1.1.2",
    "@ionic/cli-plugin-ionic-angular": "^1.1.2",
    "@types/moment-range": "^3.0.0",
    "hammerjs": "^2.0.8",
    "typescript": "2.3.2"
  "description": "description",
  "cordova": {
    "platforms": [
    "plugins": {
      "cordova-plugin-camera": {
        "CAMERA_USAGE_DESCRIPTION": "This app uses the camera."
      "cordova-plugin-console": {},
      "cordova-plugin-device": {},
      "cordova-plugin-fcm": {},
      "cordova-plugin-file": {},
      "cordova-plugin-file-transfer": {},
      "cordova-plugin-geolocation": {
        "GEOLOCATION_USAGE_DESCRIPTION": "This app users the location."
      "cordova-plugin-media": {},
      "cordova-plugin-splashscreen": {},
      "cordova-plugin-statusbar": {},
      "cordova-plugin-whitelist": {},
      "cordova-sqlite-storage": {},
      "ionic-plugin-keyboard": {},
      "cordova-plugin-crosswalk-webview": {
        "XWALK_VERSION": "22+",
        "XWALK_LITEVERSION": "xwalk_core_library_canary:17+",
        "XWALK_COMMANDLINE": "--disable-pull-to-refresh-effect",
        "XWALK_MODE": "embedded",
        "XWALK_MULTIPLEAPK": "true"
      "com.synconset.imagepicker": {

Wow. There’s a lot going on there. Probably not the proximate cause of this problem, but those dueling imagepicker plugins look like trouble. typescript should be in devDependencies, not dependencies. There was a rather confusing bug involving moment a while back, but it presented differently. However, it did get me to ditch moment completely in favor of date-fns and I’m glad I did. I suspected it might be related to some of those unusual URL versions, but dropped one in a scratch project and it built fine, so it’s not that.

You could try npm i -g ionic@canary in case our environments are different. I’m running 3.1.2-alpha.df0500d8.

@rapropos I faced the same problem even after upgrading to ionic@canary and removed typescript form dependencies.
However after downgrading to ionic 2.2.3 everything working fine


Thanks for reporting back. The problem seems to lie in the twilight zone somewhere between CLI and app-scripts.