在我更新 nativescript 核心模块之前,一切都很好。
现在我遇到了一些错误
ERROR in ./app/routes/user/login/login.component.ts
Module not found: Error: Can't resolve 'nativescript-ios-uuid' in '/Users/.../src/app/routes/user/login'
@ ./app/routes/user/login/login.component.ts 67:29-61
@ ./app/routes/user/user.module.ts
@ ../$$_lazy_route_resource lazy namespace object
@ ../node_modules/@angular/core/fesm5/core.js
@ ./app/app.module.ts
@ ./main.ts
ERROR in node_modules/@types/jest/index.d.ts(39,22): error TS1005: ';' expected.
node_modules/@types/jest/index.d.ts(39,46): error TS1005: ',' expected.
node_modules/@types/jest/index.d.ts(220,81): error TS1144: '{' or ';' expected.
node_modules/@types/jest/index.d.ts(220,161): error TS1005: '(' expected.
node_modules/@types/jest/index.d.ts(220,168): error TS1005: ')' expected.
更新后(我还更新了 nativescript),要求我迁移到 webpack。
在我看到这些错误之后,我尝试了一些修复但没有运气,所以我删除了所有对nativescript-ios-uuid
以防万一的引用...但是错误仍然出现,尽管我将它从login.ts
那么为什么 webpack 没有刷新我所做的更改呢?另外关于开玩笑,我更新到新版本仍然有同样的问题。
我的 package.json:
{
"nativescript": {
"id": "com.company.app",
"tns-android": {
"version": "5.4.0"
},
"tns-ios": {
"version": "5.4.1"
}
},
"description": "my name",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"scripts": {
"lint": "tslint \"src/**/*.ts\""
},
"dependencies": {
"@angular/animations": "~6.1.0",
"@angular/common": "~6.1.0",
"@angular/compiler": "~6.1.0",
"@angular/core": "~6.1.0",
"@angular/forms": "~6.1.0",
"@angular/http": "~6.1.0",
"@angular/platform-browser": "~6.1.0",
"@angular/platform-browser-dynamic": "~6.1.0",
"@angular/router": "~6.1.0",
"angular-font-awesome": "^3.1.2",
"base-64": "^0.1.0",
"cordova-support-google-services": "^1.3.1",
"font-awesome": "^4.7.0",
"nativescript-angular": "~6.2.0",
"nativescript-bitmap-factory": "^1.7.1",
"nativescript-fontawesome": "^1.0.0",
"nativescript-localstorage": "^2.0.0",
"nativescript-ng2-fonticon": "^1.3.4",
"nativescript-open-app": "^0.2.0",
"nativescript-permissions": "^1.2.3",
"nativescript-platform-css": "^1.6.6",
"nativescript-plugin-firebase": "^7.7.0",
"nativescript-social-share": "^1.5.1",
"nativescript-telephony": "^1.0.4",
"nativescript-theme-core": "~1.0.4",
"nativescript-toasty": "^1.3.1",
"nativescript-ui-sidedrawer": "~5.0.0",
"nativescript-version-number": "^1.1.0",
"reflect-metadata": "~0.1.10",
"rxjs": "~6.2.0",
"tns-core-modules": "^5.4.2",
"utf8": "^3.0.0",
"zone.js": "~0.8.18"
},
"devDependencies": {
"@angular/compiler-cli": "~6.1.0",
"@nativescript/schematics": "~0.3.0",
"@ngtools/webpack": "~6.2.0",
"@types/jest": "^23.3.14",
"codelyzer": "~4.5.0",
"nativescript-dev-sass": "~1.6.0",
"nativescript-dev-typescript": "~0.7.0",
"nativescript-dev-webpack": "0.24.1",
"tslint": "~5.11.0",
"typescript": "~2.7.2"
},
"readme": "NativeScript Application",
"author": "me"
}
tsconfig.json
{
"compilerOptions": {
"module": "commonjs",
"target": "es5",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"noEmitHelpers": true,
"noEmitOnError": true,
"lib": [
"es6",
"dom",
"es2015.iterable"
],
"baseUrl": ".",
"paths": {
"~/*": [
"src/*"
],
"*": [
"./node_modules/tns-core-modules/*",
"./node_modules/*"
]
}
},
"exclude": [
"node_modules",
"platforms"
]
}
--- 建议后的堆栈跟踪:
An uncaught Exception occurred on "main" thread.
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.company.app/com.tns.NativeScriptActivity}: com.tns.NativeScriptException:
Calling js method onCreate failed
Error: Could not resolve app.component.html. Looked for: /data/data/com.companu.app/files/app/app.component.html.
File: "file:///data/data/com.company.app/files/app/vendor.js, line: 66971, column: 12
StackTrace:
Frame: function:'ZoneAwareError', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 70628, column: 33
Frame: function:'push.../node_modules/nativescript-angular/resource-loader.js.FileSystemResourceLoader.resolve', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 66971, column: 19
Frame: function:'push.../node_modules/nativescript-angular/resource-loader.js.FileSystemResourceLoader.get', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 66957, column: 33
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.DirectiveNormalizer._fetch', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 10524, column: 43
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.DirectiveNormalizer._preParseTemplate', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 10563, column: 29
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.DirectiveNormalizer.normalizeTemplate', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 10551, column: 36
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.loadDirectiveMetadata', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 18464, column: 58
Frame: function:'', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 32017, column: 55
Frame: function:'', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 32016, column: 72
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._loadModules', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 32013, column: 75
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 31991, column: 36
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 31951, column: 37
Frame: function:'push.../node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js.CompilerImpl.compileModuleAsync', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 51992, column: 31
Frame: function:'push.../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 37433, column: 25
Frame: function:'_bootstrapper', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 66092, column: 35
Frame: function:'', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 66155, column: 19
Frame: function:'push.../node_modules/tns-core-modules/data/observable/observable.js.Observable.notify', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 93895, column: 23
Frame: function:'notifyLaunch', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 112261, column: 17
Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 112183, column: 28
Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 112032, column: 14
Frame: function:'push.../node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 109846, column: 25
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2817)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2892)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1593)
at android.os.Handler.dispatchMessage(Handler.java:105)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6541)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.Zygote$MethodAndArgsCaller.run(Zygote.java:240)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:767)
Caused by: com.tns.NativeScriptException:
Calling js method onCreate failed
Error: Could not resolve app.component.html. Looked for: /data/data/com.company.app/files/app/app.component.html.
File: "file:///data/data/com.company.app/files/app/vendor.js, line: 66971, column: 12
StackTrace:
Frame: function:'ZoneAwareError', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 70628, column: 33
Frame: function:'push.../node_modules/nativescript-angular/resource-loader.js.FileSystemResourceLoader.resolve', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 66971, column: 19
Frame: function:'push.../node_modules/nativescript-angular/resource-loader.js.FileSystemResourceLoader.get', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 66957, column: 33
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.DirectiveNormalizer._fetch', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 10524, column: 43
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.DirectiveNormalizer._preParseTemplate', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 10563, column: 29
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.DirectiveNormalizer.normalizeTemplate', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 10551, column: 36
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.loadDirectiveMetadata', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 18464, column: 58
Frame: function:'', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 32017, column: 55
Frame: function:'', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 32016, column: 72
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._loadModules', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 32013, column: 75
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 31991, column: 36
Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 31951, column: 37
Frame: function:'push.../node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js.CompilerImpl.compileModuleAsync', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 51992, column: 31
Frame: function:'push.../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 37433, column: 25
Frame: function:'_bootstrapper', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 66092, column: 35
Frame: function:'', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 66155, column: 19
Frame: function:'push.../node_modules/tns-core-modules/data/observable/observable.js.Observable.notify', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 93895, column: 23
Frame: function:'notifyLaunch', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 112261, column: 17
Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 112183, column: 28
Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 112032, column: 14
Frame: function:'push.../node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate', file:'file:///data/data/com.company.app/files/app/vendor.js', line: 109846, column: 25
at com.tns.Runtime.callJSMethodNative(Native Method)
at com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1203)
at com.tns.Runtime.callJSMethodImpl(Runtime.java:1083)
at com.tns.Runtime.callJSMethod(Runtime.java:1070)
at com.tns.Runtime.callJSMethod(Runtime.java:1050)
at com.tns.Runtime.callJSMethod(Runtime.java:1042)
at com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:19)
at android.app.Activity.performCreate(Activity.java:6975)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1213)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2770)
... 9 more