简体   繁体   English

找不到模块:“ nativescript-angular / http”,相对于:app / tns_modules /

[英]Failed to find module: “nativescript-angular/http”, relative to: app/tns_modules/

I'm using NativeScript 6.1.1 with Angular 8.0 and I did have the 'tns preview' going at some point, but now when I try to run 'tns preview' and use my Samsung Galaxy S8 (Android 7) I get this error 我在Angular 8.0中使用NativeScript 6.1.1,确实在某个时候进行过“ tns预览”,但是现在当我尝试运行“ tns预览”并使用我的Samsung Galaxy S8(Android 7)时,出现此错误

Successfully sent initial files for platform android.
LOG from device Galaxy S8: com.tns.Runtime.callJSMethodNative(Native Method)
LOG from device Galaxy S8: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1209)
LOG from device Galaxy S8: com.tns.Runtime.callJSMethodImpl(Runtime.java:1096)
LOG from device Galaxy S8: Angular is running in the development mode. Call enableProdMode() to enable the production mode.
LOG from device Galaxy S8: com.tns.Runtime.callJSMethod(Runtime.java:1083)
LOG from device Galaxy S8: ERROR Error: Uncaught (in promise): Error: com.tns.NativeScriptException: Failed to find module: "nativescript-angular/http", relative to: app/tns_modules/
LOG from device Galaxy S8: com.tns.Module.resolvePath(Module.java:56)
LOG from device Galaxy S8: com.tns.Module.resolvePathHelper(Module.java:151)
LOG from device Galaxy S8: com.tns.Runtime.callJSMethod(Runtime.java:1063)
LOG from device Galaxy S8: com.tns.Runtime.callJSMethod(Runtime.java:1055)
LOG from device Galaxy S8: com.tns.NativeScriptActivity.onCreate(NativeScriptActivity.java:20)
LOG from device Galaxy S8: android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
LOG from device Galaxy S8: android.app.Activity.performCreate(Activity.java:6955)
LOG from device Galaxy S8: android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
LOG from device Galaxy S8: android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3045)
LOG from device Galaxy S8: and...
LOG from device Galaxy S8: android.app.ActivityThread.-wrap14(ActivityThread.java)

I've tried refreshing everything with; 我已经尝试过刷新所有内容;

rm -rf node_modules platforms hooks
npm i
tns run android
tns preview

That didn't help. 那没有帮助。 It works in the emulator. 它可以在模拟器中工作。 I tried to use http-client instead but it wouldn't start. 我尝试改用http-client,但无法启动。 I've updated to the latest packages and that too didn't help. 我已经更新到最新的软件包,但这也无济于事。

As of Angular 8 @angular/http is removed so nativescript-angular/http . 从Angular 8开始, @angular/http被删除,所以nativescript-angular/http

You must migrate to NativeScriptHttpClientModule 您必须迁移NativeScriptHttpClientModule

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM