iosangularnativescriptwebpack-5

Nativescript : IOS App crashes when versions are updated in package.json


This is my configuration - MacOS - Ventura 13.5, Xcode - 14

enter image description here

This is the package.json of my native script application which is working fine with no issues.

{
  "name": "mytestapp",
  "main": "./src/main.ts",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@angular/animations": "~15.1.0",
    "@angular/common": "~15.1.0",
    "@angular/compiler": "~15.1.0",
    "@angular/core": "~15.1.0",
    "@angular/forms": "~15.1.0",
    "@angular/platform-browser": "~15.1.0",
    "@angular/platform-browser-dynamic": "~15.1.0",
    "@angular/router": "~15.1.0",
    "@nativescript/angular": "^15.0.0",
    "@nativescript/core": "~8.4.0",
    "@nativescript/theme": "~3.0.2",
    "rxjs": "~7.6.0",
    "zone.js": "~0.12.0"
  },

  "devDependencies": {
    "@angular-devkit/build-angular": "~15.1.0",
    "@angular/compiler-cli": "~15.1.0",
    "@nativescript/types": "~8.4.0",
    "@nativescript/webpack": "~5.0.12",
    "@ngtools/webpack": "~15.1.0",
    "typescript": "~4.8.4"
  }
}

I am facing a weird issue, when I try to upgrade the angular and native script package versions in the package.json

{
  "name": "mytestapp",
  "main": "./src/main.ts",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@angular/animations": "~16.2.0",
    "@angular/common": "~16.2.0",
    "@angular/compiler": "~16.2.0",
    "@angular/core": "~16.2.0",
    "@angular/forms": "~16.2.0",
    "@angular/platform-browser": "~16.2.0",
    "@angular/platform-browser-dynamic": "~16.2.0",
    "@angular/router": "~16.2.0",
    "@nativescript/angular": "^16.0.0",
    "@nativescript/core": "~8.5.9",
    "@nativescript/theme": "~3.0.2",
    "rxjs": "~7.6.0",
    "zone.js": "~0.13.1"
  },

  "devDependencies": {
    "@angular-devkit/build-angular": "~16.2.0",
    "@angular/compiler-cli": "~16.2.0",
    "@nativescript/ios": "8.5.2",
    "@nativescript/types": "~8.5.0",
    "@nativescript/webpack": "~5.0.17",
    "@ngtools/webpack": "~16.2.0",
    "typescript": "~5.1.6"
  }
}

and when i run "npm install" and "tns run ios". It Builds fine but

My app opens and crashes with below error

can anyone help me with this issue, not sure what's going on, I just updated the packages
and the app is crashing

enter image description here

Restarting application on device 3602221B-FFEF-4B2A-88D3-FA8CF56F2930...

***** Fatal JavaScript exception - application has been terminated. *****
NativeScript encountered a fatal error: Uncaught SyntaxError: Unexpected token '{'
at
require(:1:137)
at __webpack_require__.f.require(file: src/webpack:/mytestapp/webpack/runtime/require chunk loading:29:0)
at (file: src/webpack:/mytestapp/webpack/runtime/ensure chunk:6:0)
at __webpack_require__.e(file: src/webpack:/mytestapp/webpack/runtime/ensure chunk:5:0)
at __webpack_require__.X(file: src/webpack:/mytestapp/webpack/runtime/startup entrypoint:5:0)
at (file:///app/bundle.js:393:47)
at (file:///app/bundle.js:398:3)
at require(:1:137)

Solution

  • I got the same error. Just updated Nativescript CLI to the latest version(8.5.3) and everything works fine.

    npm install -g nativescript
    ns clean
    ns run ios