Ionic-app-scripts: Receive "UnhandledPromiseRejectionWarning" error in ionic serve

Created on 20 Dec 2016  路  16Comments  路  Source: ionic-team/ionic-app-scripts

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/
http://ionicworldwide.herokuapp.com/

Short description of the problem:

After running ionic serve, when modifying a file, I receive a UnhandledPromiseRejectionWarning error.

What behavior are you expecting?

The change should be detected, any SASS or TypeScript files should be recompiled, and the page reloaded (if livereload is active).

Steps to reproduce:

  1. Run ionic serve on a working project.
  2. Edit a SCSS or TS file and save.

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

Other information: (e.g. stacktraces, related issues, suggestions how to fix, stackoverflow links, forum links, etc)
Full output:

> ionic-hello-world@ ionic:serve /root/.../.../...
> ionic-app-scripts serve "--port" "9002" "--livereload-port" "9003" "--nobrowser" "--address" "165.x.x.66" "--lab" "--serverlogs"

[17:23:35]  ionic-app-scripts 0.0.48
[17:23:35]  watch started ...
[17:23:35]  build dev started ...
[17:23:35]  clean started ...
[17:23:35]  clean finished in 9 ms
[17:23:35]  copy started ...
[17:23:35]  transpile started ...
[17:23:45]  transpile finished in 10.30 s
[17:23:45]  webpack started ...
[17:23:46]  copy finished in 10.64 s
[17:24:13]  webpack finished in 27.67 s
[17:24:13]  sass started ...
[17:24:15]  sass finished in 1.81 s
[17:24:15]  build dev finished in 39.87 s
[17:24:15]  watch ready in 40.12 s
[17:24:15]  dev server running: http://165.x.x.x:9002/

[17:24:31]  build started ...
(node:13998) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'send' of undefined

Most helpful comment

Hello guys, i had the same issue and i fixed it with these commands:

1) rm -rf ./node_modules
2) npm install
3) ionic cordova rm android && ionic cordova add android

All 16 comments

I'm seeing this too. It makes the current version of app-scripts unusable, as the build does not complete. It happens to me after the first time I save a file.

This seems to come and go. Now it's working, but it wasn't earlier today.

@codisms, are you writing on a new blank ionic project? What does your ionic info look like? Mine isn't solved yet. =(

No, it's not blank, and I didn't do anything for it to have changed. It just started working. Will comment should it stop again, but I wouldn't consider it closed.

I dont know if its releted but ive seen this a couple of times when starting a ionic serve -b and changing a file before i have refreshed a existing browser tab to connect it to a new serve.

I see this too on version 0.0.48 and I also get Mixed Content: The page at 'https://3ZzLYsgk.ngrok.io/' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://3ZzLYsgk.ngrok.io:53703/'. This request has been blocked; this endpoint must be available over WSS. everytime I use it because I'm using https and I don't know how to change the ionic websocket endpoint. So maybe this UnhandledPromiseRejectionWarning error could in fact be caused by a websocket problem

I am also getting this when doing "ionic build browser" using:

ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.4
Ionic CLI Version: 2.1.18
Ionic App Lib Version: 2.1.9
Ionic App Scripts Version: 0.0.47
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.2
Xcode version: Not installed

Build output:

ionic-hello-world@ ionic:build C:\Bitnami\wampstack-5.6.22-0\apps\sc-metronome
ionic-app-scripts build

keywords if/then/else require v5 option
[17:24:12] ionic-app-scripts 0.0.47
[17:24:12] build dev started ...
[17:24:12] clean started ...
[17:24:12] clean finished in 23 ms
[17:24:12] copy started ...
[17:24:12] transpile started ...
[17:24:26] transpile finished in 14.55 s
[17:24:26] webpack started ...
[17:24:27] copy finished in 15.17 s
(node:1872) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'content' of null
Error loading cordova-browser

Running command: cmd "/s /c "C:\Bitnami\wampstack-5.6.22-0\apps\sc-metronome\platforms\browser\cordova\build.bat""

Cleaning Browser project

Figured this one out, thanks to some comments in https://github.com/driftyco/ionic-app-scripts/issues/599.

This happens to me when I don't have a browser open with the app loaded. PR submitted which fixes the issue.

This should be fixed now. Will be published tomorrow in 0.0.49.

Please let me know if it's not.

Thanks,
Dan

"npm update" may solve this problem

I got this error now,

  1. copied the whole repo directory to another directory (V2)
  2. cd V2
  3. git checkout -b V2.0 remote/V2.0
  4. npm update
  5. ionic cordova build ios

some output then

(node:67507) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: channel closed

I'm also getting this with ionic update after ionic config set -g backend legacy. Can't seem to get my app to work in ionic view any more either. @ionic/app-scripts : 2.1.4. I think the ionic config logged me out of the normal app.ionic.io account. As soon as I logged back in and did ionic link it worked. System to upload yesterday was flaky. Could not get anything working with new pro or old system.

Hello guys, i had the same issue and i fixed it with these commands:

1) rm -rf ./node_modules
2) npm install
3) ionic cordova rm android && ionic cordova add android

Worked for me :

  1. rm -rf ./node_modules
  2. npm install --no-optional --no-shrinkwrap --no-package-lock
  3. ionic serve

Hello guys, i had the same issue and i fixed it with these commands:

  1. rm -rf ./node_modules
  2. npm install
  3. ionic cordova rm android && ionic cordova add android

this command worked for me, Thank you

Was this page helpful?
0 / 5 - 0 ratings