ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 305 forks source link

app-scripts serve unexpectedly failed.settings: undefinedcontext: [object Object] ionic3 #1002

Open boyfunky opened 7 years ago

boyfunky commented 7 years ago

Short description of the problem:

Create a brand new ionic3 project and ran ionic serve -s -c and i get this error

app-scripts serve unexpectedly failed.settings: undefinedcontext: [object Object] (node:9014) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: channel closed

What behavior are you expecting?

Expecting it to load the page but it doesnt

Steps to reproduce:

  1. Create a brand new ionic3 project
  2. Run ionic serve -s -c

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

blinks32 commented 7 years ago

This worked for me. 'npm install' and i believe it reinstalled some missing dependencies.

mimamghozalie commented 7 years ago

i remove folder node_modules with rm -rf node_modules and run npm install

its worked for me

JustasKuizinas commented 7 years ago

Getting same error

rebelholic commented 7 years ago

@mimamghozalie still not luck and getting same error

mimamghozalie commented 7 years ago

@rebelholic this is my ionic info, Maybe if your version is the same as mine it will be resolved

info

floriantraber commented 7 years ago

try npm run ionic:serve

https://github.com/driftyco/ionic-app-scripts/commit/e5a4134b090d09342bbfb2b2fe16778663a9c151 should fix it.

rebelholic commented 7 years ago

@mimanghozalie Thanks already fixed after updated with latest version.

global packages:

    @ionic/cli-utils : 1.2.0
    Cordova CLI      : 7.0.0
    Ionic CLI        : 3.2.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.2.0
    @ionic/cli-plugin-ionic-angular : 1.2.0
    Cordova Platforms               : android 6.2.3
    Ionic Framework                 : ionic-angular 3.1.1

System:

    Node       : v6.10.1
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
dev-ext commented 7 years ago

Still facing same problem


global packages:

    @ionic/cli-utils : 1.2.0
    Ionic CLI        : 3.2.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-ionic-angular : 1.2.0
    Ionic Framework                 : ionic-angular 3.3.0

System:

    Node       : v7.9.0
    OS         : Linux 4.8
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
boyfunky commented 7 years ago

reinstall your ionic version back to the ionic2 version you were using before upgrade to ionic3. Ionic3 version has some issues.

in my case i did this and it resolved my issue npm install -g ionic@2.2.3

plmetz commented 7 years ago

I was having the same problem. In my case it seemed to be related to VS Code. If I do ionic serve before starting VS Code it works just fine. The only thing is that it seems then VS Code's git integration is affected and it doesn't track changed files. Hope this helps and hope this is fixed soon.

rebelholic commented 7 years ago

so where ionic developer don't have give any feedback to fix this bug to prevent get same problem for future update?

Didi3aone commented 7 years ago

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

massivebrains commented 7 years ago

I simply returned back to 2.2.3

dev-ext commented 7 years ago

old package.json

"scripts": {
    "ionic:build": "ionic-app-scripts build",
    "ionic:serve": "ionic-app-scripts serve"
  },
  "dependencies": {
    "@angular/common": "^4.1.1",
    "@angular/compiler": "^4.1.1",
    "@angular/compiler-cli": "^4.1.1",
    "@angular/animations": "4.1.1",
    "@angular/core": "^4.1.1",
    "@angular/forms": "^4.1.1",
    "@angular/http": "^4.1.1",
    "@angular/platform-browser": "^4.1.1",
    "@angular/platform-browser-dynamic": "^4.1.1",
    "@angular/platform-server": "^4.1.1",
    "@ionic-native/core": "^3.6.1",
    "@ionic-native/splash-screen": "^3.6.1",
    "@ionic-native/status-bar": "^3.6.1",
    "angularfire2": "^4.0.0-rc.0",
    "firebase": "^3.9.0",
    "ionic-angular": "3.1.1",
    "ionicons": "3.0.0",
    "ng2-validation": "~4.2.0",
    "rxjs": "^5.3.1",
    "zone.js": "^0.8.10"
  },
  "devDependencies": {
    "@ionic/app-scripts": "~1.3.7",
    "typescript": "~2.2.2"
  },
  "cordovaPlugins": [
    "cordova-plugin-whitelist",
    "cordova-plugin-console",
    "cordova-plugin-statusbar",
    "cordova-plugin-device",
    "cordova-plugin-splashscreen",
    "ionic-plugin-keyboard"
  ],
  "cordovaPlatforms": [
    "ios",
    {
      "platform": "ios",
      "version": "",
      "locator": "ios"
    }
  ]

new updated package.json

  "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.1.2",
    "@angular/compiler": "4.1.2",
    "@angular/compiler-cli": "4.1.2",
    "@angular/core": "4.1.2",
    "@angular/forms": "4.1.2",
    "@angular/http": "4.1.2",
    "@angular/platform-browser": "4.1.2",
    "@angular/platform-browser-dynamic": "4.1.2",
    "@ionic-native/core": "3.10.2",
    "@ionic-native/splash-screen": "3.10.2",
    "@ionic-native/status-bar": "3.10.2",
    "@ionic/storage": "2.0.1",
    "ionic-angular": "3.3.0",
    "angularfire2": "^4.0.0-rc.0",
    "firebase": "^3.9.0",
    "ionicons": "3.0.0",
    "rxjs": "5.1.1",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.11",
    "@ionic-native/camera": "3.11.0",
    "@ionic-native/google-maps": "3.11.0",
    "@ngx-translate/core": "6.0.1",
    "@ngx-translate/http-loader": "0.0.3"
  },
  "devDependencies": {
    "@ionic/app-scripts": "1.3.7",
    "@ionic/cli-plugin-ionic-angular": "1.3.0",
    "typescript": "2.3.3"
  }

It's just dependecy problem .

ionic serve now working..

asmaratantra commented 7 years ago

try... npm run ionic:serve

CarlosAyala commented 7 years ago

Hi! I have the same problem.

app-scripts serve unexpectedly failed.settings: undefinedcontext: [object Object] (node:14623) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: channel closed

With npm run ionic:serve works but I lost the live reload. "dependencies": { "@angular/animations": "4.1.2", "@angular/common": "4.1.2", "@angular/compiler": "4.1.2", "@angular/compiler-cli": "4.1.2", "@angular/core": "4.1.2", "@angular/forms": "4.1.2", "@angular/http": "4.1.2", "@angular/platform-browser": "4.1.2", "@angular/platform-browser-dynamic": "4.1.2", "@ionic-native/core": "^3.10.2", "@ionic-native/file": "^3.12.1", "@ionic-native/local-notifications": "^3.12.1", "@ionic-native/network": "^3.12.1", "@ionic-native/splash-screen": "^3.10.2", "@ionic-native/status-bar": "^3.10.2", "@ionic-native/toast": "^3.12.1", "@ionic-native/transfer": "^3.12.1", "@ionic/storage": "2.0.1", "angular-sortablejs": "^2.0.6", "cordova-plugin-sqlite-2": "^1.0.4", "ionic-angular": "3.3.0", "ionicons": "3.0.0", "ng2-animate": "^1.2.1", "ng2-dragula": "^1.5.0", "pouchdb": "^6.2.0", "pouchdb-adapter-cordova-sqlite": "^2.0.2", "pouchdb-find": "^6.2.0", "rxjs": "5.1.1", "sortablejs": "^1.6.0", "sw-toolbox": "3.6.0", "zone.js": "0.8.11" }, "devDependencies": { "@ionic/app-scripts": "1.3.7", "@ionic/cli-plugin-cordova": "1.3.0", "@ionic/cli-plugin-ionic-angular": "1.3.0", "typescript": "2.3.3" }, "description": "An Ionic project", "cordova": { "plugins": { "cordova-plugin-sqlite-2": {}, "de.appplant.cordova.plugin.local-notification": {}, "cordova-plugin-x-toast": {}, "cordova-plugin-network-information": {}, "cordova-plugin-file": {}, "cordova-plugin-file-transfer": {} } }

ippeiukai commented 7 years ago

I understand this is going to be fixed at the next version, but is there any workaround?

https://github.com/ionic-team/ionic-app-scripts/issues/1002#issuecomment-303699801

I've tried specifying "@ionic/app-scripts": "git:github.com/ionic-team/ionic-app-scripts.git#e5a4134" in package.json, but doesn't seem to work.

(yes, npm run ionic:serve works, but we do not really want to change the team-wide workflow for this...)

blinks32 commented 7 years ago

The fastest solution i use is simply calling _npm install

disujha commented 7 years ago

npm install -g ionic ... works for this

CarlosAyala commented 7 years ago

This bug is really annoying. I remove the node modules folder with rm node_modules -R. Then I reload de modules with npm install. I try ionic serve again and works.

But if I close the ionic serve process and try again ionic serve the process fail again with app-scripts serve unexpectedly failed.settings: undefinedcontext: [object Object].

If I make the process of remove the node modules and reloaded it the ionic serve works again.

cnx-brunomelo commented 7 years ago

I have the same error:

global packages:

@ionic/cli-plugin-proxy : 1.1.2
@ionic/cli-utils        : 1.4.0
Cordova CLI             : 7.0.1 
Ionic CLI               : 3.4.0

local packages:

@ionic/app-scripts              : 1.3.7
@ionic/cli-plugin-cordova       : 1.4.0
@ionic/cli-plugin-ionic-angular : 1.3.1
Cordova Platforms               : android 5.2.2 browser 4.1.0
Ionic Framework                 : ionic-angular 3.4.2

System:

Node       : v6.9.4
OS         : Linux 4.4
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 5.0.3 
janpio commented 7 years ago

Everybody complaining: Please post your ionic info output (in the project causing the error). Without that your report is useless. If you are not on the current Ionic CLI version (3.4.0 at the time of writing), update before you do. Also run the command throwing the error with --verbose at the end and post the result.

andriivasylchenko commented 7 years ago

I've managed to solve this on linux with echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

cause error seems to be related with ENOSPC https://github.com/gulpjs/gulp/issues/217

thsbrown commented 7 years ago

Getting the error as well. Here is my ionic info

[DEBUG] Loading global plugin @ionic/cli-plugin-proxy
[DEBUG] Throwing PLUGIN_NOT_INSTALLED for global @ionic/cli-plugin-proxy
[DEBUG] Loading local plugin @ionic/cli-plugin-cordova
[DEBUG] Loading local plugin @ionic/cli-plugin-ionic-angular

global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : android 5.2.2 browser 4.1.0
    Ionic Framework                 : ionic-angular 3.4.0

System:

    Node       : v6.11.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 3.10.7 
Nexeuz commented 7 years ago

I try uninstall ionic withionic -g uninstall and then install withionic -g install works for me

thsbrown commented 7 years ago

Updating to the latest app-scripts (1.3.8) solved the problem for me!

Bernardoow commented 7 years ago

[2] Updating to the latest app-scripts (1.3.8) solved the problem for me!

npm install @ionic/app-scripts@latest --save-dev

albe-rosado commented 7 years ago

In my case, npm stocks showing this while fetching the package lastest version: [..................] - loadDep:xml2js: sill resolveWithNewModule @ionic/app-scripts@1.3.8 checking installable status

My ionic info: ` global packages:

@ionic/cli-utils : 1.4.0
Ionic CLI        : 3.4.0

local packages:

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

System:

Node       : v8.1.2
OS         : Linux 4.10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed
npm        : 5.0.3

`

vkniazeu commented 7 years ago

Updating to 1.3.8 solves this particular problem, but 1.3.8 does not work with --prod builds and custom webpack configs (#954).

techyaura commented 7 years ago

@floriantraber , Hey you have saved my day. I was stuck into this for one day & resolved all the previous error in settting up & this was the last one which stop me & u did it. So Thanks a lot.

DaniSchenk commented 7 years ago

as @andriivasylchenko said, increasing the max_user_watches on my ubuntu system solved the problem. more info: https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers

beaubrewer commented 7 years ago

Closing VS Code before running ionic serve prevented this error. This workaround was mentioned by @plmetz. I am using the git plugin as well, which might be maxing out the file watches available. I increased the max_user_watches as suggested by @andriivasylchenko and it solved the problem for me.

eduardomarco commented 7 years ago

How to resolve this error? Help. captura de tela 2017-08-02 14 08 36

vkniazeu commented 7 years ago

Have you added <script src="build/vendor.js"></script> to your index.html, @eduardomarco ?

eduardomarco commented 7 years ago

I adding but dont show the map. captura de tela 2017-08-02 15 34 48

sarthak1994 commented 7 years ago

Look for missing service-worker.js in src folder. Fixed problem in my case.

kukipei commented 7 years ago

After ionic serve

I am having the same error [ERROR] app-scripts serve unexpectedly failed.settings: undefinedcontext: [object Object]

ionic info `cli packages: (C:\Users\Peda\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.9.1
ionic (Ionic CLI) : 3.9.1

local packages:

@ionic/app-scripts : 1.3.7
Ionic Framework    : ionic-angular 3.2.0

System:

Node : v6.11.2
npm  : 3.10.10
OS   : Windows 10

`

npm run ionic:serve runs ok.

usama-ayub commented 7 years ago

npm or yarn install @ionic/app-scripts@latest --save-dev try this command it work

codinronan commented 7 years ago

I'm getting this too, and none of the above solutions have worked for me. Just started for me this afternoon - even 12 hours ago this worked.

After a FULL REBOOT of my Mac, this is literally the very first command I ran. Therefore no file watchers can be open, VS Code is not running, only Chrome is open to post this - and I still get it. I can no longer debug on device thanks to this.

My ionic info:

cli packages: (/Users/--/.nvm/versions/node/v8.9.0/lib/node_modules)

    @ionic/cli-utils  : 1.19.0
    ionic (Ionic CLI) : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.2
    Cordova Platforms  : android 6.3.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.1.1
    Node              : v8.9.0
    npm               : 5.5.1
    OS                : macOS High Sierra
    Xcode             : Xcode 9.1 Build version 9B55

Environment Variables:

    ANDROID_HOME : /Users/--/Library/Android/sdk

Misc:

    backend : pro
codinronan commented 7 years ago

Ok I've done a bit of digging on this. If you remove ionic from the run command and just run cordova directly, you can see the real errors.

It seems the IONIC error is specifically referring to the fact that it is losing its connection to cordova. That's all that error means. Whenever you see that error, it almost always means that there's actually an error in cordova.

So, in my case, this was the real error in cordova:

Error: Cannot read property 'find' of undefined

That error tracks back to a bug in Cordova where the config.xml files inside the platforms folder get zero'd out and never re-created, so the obvious solution was simply

cordova platform remove android
cordova platform add android

and all is well.

I still can't run via Ionic - there seems to be something else going on - but I can run directly through cordova.

By the way the Ionic command that fails is this one:

ionic cordova run android -lcs --address 192.168.0.24
joshstrange commented 6 years ago

I really wish it would give you a little more to go on when you get this error. For me I tracked it back to the fact the --address I was passing into ionic cordova run ios --device -lcs --address='x.x.x.x' was for the IP address I have at work. I have a alias for this command in my .zshrc (.bashrc) and I mistakenly thought it was getting my current ip address each run, it turns out it was doing that on shell launch but not for each time I ran the alias. If I had just opened a new shell it would have worked but since I reused a shell I had opened at work it had the wrong IP address.

I doubt many people will run into this but I wanted to record it here incase someone did. Trying to bind to an IP address that was no my laptop caused this issue for me.

intersides commented 6 years ago

for me was the same issue. The ip address I kept stored to use it for --livereload has changed since it was dynamically assigned. Changing the address in --livereload fixed it.