Ionic 4 - Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch()

Getting error for building for device (iOS , not tried on Android) -

(node:944) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)

(node:944) [DEP0018] 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.

Have not added any code simply created a Ionic 4 project using CLI - ionic start Sampleapp tabs --type=angular and added iOS platform while building for iOS getting above error.

Ionic Info -

Ionic:

   ionic (Ionic CLI)          : 4.1.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.7
   @angular-devkit/core       : 0.7.5
   @angular-devkit/schematics : 0.7.5
   @angular/cli               : 6.1.5
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.6

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.4, (and 4 other plugins)

System:

   NodeJS : v8.11.4 (/usr/local/bin/node)
   npm    : 5.6.0
   OS     : macOS High Sierra

Add --verbose at the end of the command and post the result.
That will give us a better view of what’s wrong.

Unfortunately I am getting same error as previously. :frowning:

Yeah, but post the log, it’ll help us help you.

Thanks you for your prompt response, here is the logs generated my CLI -

  Admins-MacBook-Pro:MyWatch Satish$ ionic cordova build ios --verbose
  ionic:cli-utils Terminal info: { tty: true, ci: false } +0ms
  ionic:cli-utils CLI global options: { _: [ 'cordova', 'build', 'ios' ], help: null, h: null, verbose: true, quiet: null, interactive: true, color: true, confirm: null, json: null, project: null, '--': [] } +3ms
  ionic:cli-utils:lib:project Project type from config: ionic/angular 4 (angular) +0ms
  ionic:cli-utils Project name: undefined +115ms
  ionic:cli Context: { binPath: '/usr/local/lib/node_modules/ionic/bin/ionic', libPath: '/usr/local/lib/node_modules/ionic', execPath: '/Users/Satish/Documents/Satish/Ionic/V4/MyWatch', version: '4.1.2' } +0ms
  ionic:cli-utils:lib:integrations:cordova:config Using config.xml: /Users/Satish/Documents/Satish/Ionic/V4/MyWatch/config.xml +0ms
  ionic:cli-utils:lib:hooks Looking for ionic:build:before npm script. +0ms
  ionic:cli-utils:lib:build Looking for ionic:build npm script. +0ms
> ng run app:ionic-cordova-build --platform=ios

Date: 2018-09-17T06:28:19.632Z
Hash: 7c74335fc8b6ae94c588
Time: 8594ms

  ionic:cli-utils:lib:hooks Looking for ionic:build:after npm script. +11s
> cordova build ios --verbose
No scripts found for hook "before_build".
No scripts found for hook "before_prepare".
Checking config.xml and package.json for saved platforms that haven't been added to the project
Config.xml and package.json platforms are the same. No pkg.json modification.
Package.json and config.xml platforms are different. Updating config.xml with most current list of platforms.
PlatformApi successfully found for platform ios
Checking config.xml for saved plugins that haven't been added to the project
Checking for any plugins added to the project that have not been installed in ios platform
No differences found between plugins added to project and installed in ios platform. Continuing...
Generating platform-specific config.xml from defaults for iOS at /Users/Satish/Documents/Satish/ionic/V4/MyWatch/platforms/ios/MyWatch/config.xml
Merging project's config.xml into platform-specific iOS config.xml
Merging and updating files from [www, platforms/ios/platform_www] to platforms/ios/www
  
Not changing launch storyboard setting in info plist.
Wrote out iOS Bundle Identifier "io.ionic.starter" and iOS Bundle Version "0.0.1" to /Users/Satish/Documents/Satish/ionic/V4/MyWatch/platforms/ios/MyWatch/MyWatch-Info.plist
No need to update build settings for launch storyboard support.
iOS Product Name has not changed (still "MyWatch")
Updating icons at platforms/ios/MyWatch/Images.xcassets/AppIcon.appiconset/
Updating splash screens at platforms/ios/MyWatch/Images.xcassets/LaunchImage.launchimage/
Updating launch storyboard images at platforms/ios/MyWatch/Images.xcassets/LaunchStoryboard.imageset/
Updating Storyboard image set contents.json
This app does not have additional resource files defined
Prepared iOS project successfully
No scripts found for hook "after_prepare".
No scripts found for hook "before_compile".
(node:2861) UnhandledPromiseRejectionWarning: xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

(node:2861) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:2861) [DEP0018] 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.

Ionic info -

Ionic:

   ionic (Ionic CLI)          : 4.1.2 (/usr/local/lib/node_modules/ionic)
   Ionic Framework            : @ionic/angular 4.0.0-beta.7
   @angular-devkit/core       : 0.7.5
   @angular-devkit/schematics : 0.7.5
   @angular/cli               : 6.1.5
   @ionic/ng-toolkit          : 1.0.8
   @ionic/schematics-angular  : 1.0.6

Cordova:

   cordova (Cordova CLI) : 8.0.0
   Cordova Platforms     : ios 4.5.5
   Cordova Plugins       : cordova-plugin-ionic-keyboard 2.1.2, cordova-plugin-ionic-webview 2.1.4, (and 4 other plugins)

System:

   NodeJS : v10.10.0 (/usr/local/bin/node)
   npm    : 6.4.1
   OS     : macOS High Sierra

Admins-MacBook-Pro:MyWatch Satish$ 

Got it fixed by upgrading my Xcode to 9.4.1. :slight_smile: