这是我的配置 - MacOS - Ventura 13.5,Xcode - 14
这是我的本机脚本应用程序的 package.json,它运行良好,没有任何问题。
{
"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"
}
}
当我尝试升级 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"
}
}
当我运行“npm install”和“tns run ios”时。它构建得很好但是
我的应用程序打开并崩溃,并出现以下错误
任何人都可以帮助我解决这个问题,不知道发生了什么,我刚刚更新了软件包
并且应用程序崩溃了
正在设备 3602221B-FFEF-4B2A-88D3-FA8CF56F2930 上重新启动应用程序... ***** 致命 JavaScript 异常 - 应用程序已终止。 ***** NativeScript 遇到致命错误:未捕获的语法错误:意外的标记“{” 在 要求(:1:137) 在 __webpack_require__.f.require(文件:src/webpack:/mytestapp/webpack/runtime/require 块加载:29:0) 在(文件:src/webpack:/mytestapp/webpack/runtime/ensure chunk:6:0) 在 __webpack_require__.e(文件:src/webpack:/mytestapp/webpack/runtime/ensure chunk:5:0) 在 __webpack_require__.X(文件:src/webpack:/mytestapp/webpack/runtime/startup 入口点:5:0) 在(文件:///app/bundle.js:393:47) 在(文件:///app/bundle.js:398:3) 根据要求(:1:137)
我遇到了同样的错误。刚刚将 Nativescript CLI 更新到最新版本(8.5.3),一切正常。
npm install -g nativescript
ns clean
ns run ios