nativescript-rtl / ui

Add right-to-left support to the NativeScript framework
MIT License
24 stars 3 forks source link

Error: Cannot find module '@nativescript-rtl/ui/grid-layout' #4

Closed adilsaeed31 closed 5 years ago

adilsaeed31 commented 5 years ago

Hi, I am trying to use this plugin for RTL layouts. but it's giving me below error.

System.err: An uncaught Exception occurred on "main" thread. System.err: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: Error: Cannot find module '@nativescript-rtl/ui/grid-layout' System.err: File: "file:///data/data/org.nativescript.phcc/files/app/bundle.js, line: 253, column: 141 System.err: System.err: StackTrace: System.err: Frame: function:'ZoneAwareError', file:'file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:1298:0 System.err: Frame: function:'webpackMissingModule', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 253, column: 45 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 253, column: 152 System.err: Frame: function:'./main.ts', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 324, column: 30 System.err: Frame: function:'__webpack_require__', file:'file:///src/webpack/bootstrap:750:0 System.err: Frame: function:'checkDeferredModules', file:'file:///src/webpack/bootstrap:43:0 System.err: Frame: function:'webpackJsonpCallback', file:'file:///src/webpack/bootstrap:30:0 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 2, column: 57 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: System.err: System.err: Error: Cannot find module '@nativescript-rtl/ui/grid-layout' System.err: System.err: StackTrace: System.err: java.lang.RuntimeException: Unable to create application com.tns.NativeScriptApplication: com.tns.NativeScriptException: Error calling module function System.err: Error: Cannot find module '@nativescript-rtl/ui/grid-layout' System.err: File: "file:///data/data/org.nativescript.phcc/files/app/bundle.js, line: 253, column: 141 System.err: System.err: StackTrace: System.err: Frame: function:'ZoneAwareError', file:'file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:1298:0 System.err: Frame: function:'webpackMissingModule', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 253, column: 45 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 253, column: 152 System.err: Frame: function:'./main.ts', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 324, column: 30 System.err: Frame: function:'__webpack_require__', file:'file:///src/webpack/bootstrap:750:0 System.err: Frame: function:'checkDeferredModules', file:'file:///src/webpack/bootstrap:43:0 System.err: Frame: function:'webpackJsonpCallback', file:'file:///src/webpack/bootstrap:30:0 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 2, column: 57 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: System.err: System.err: Error: Cannot find module '@nativescript-rtl/ui/grid-layout' System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6135) System.err: at android.app.ActivityThread.access$1300(ActivityThread.java:209) System.err: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1790) System.err: at android.os.Handler.dispatchMessage(Handler.java:106) System.err: at android.os.Looper.loop(Looper.java:193) System.err: at android.app.ActivityThread.main(ActivityThread.java:6954) System.err: at java.lang.reflect.Method.invoke(Native Method) System.err: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:537) System.err: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858) System.err: Caused by: com.tns.NativeScriptException: Error calling module function System.err: Error: Cannot find module '@nativescript-rtl/ui/grid-layout' System.err: File: "file:///data/data/org.nativescript.phcc/files/app/bundle.js, line: 253, column: 141 System.err: System.err: StackTrace: System.err: Frame: function:'ZoneAwareError', file:'file:///node_modules/nativescript-angular/zone-js/dist/zone-nativescript.js:1298:0 System.err: Frame: function:'webpackMissingModule', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 253, column: 45 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 253, column: 152 System.err: Frame: function:'./main.ts', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 324, column: 30 System.err: Frame: function:'__webpack_require__', file:'file:///src/webpack/bootstrap:750:0 System.err: Frame: function:'checkDeferredModules', file:'file:///src/webpack/bootstrap:43:0 System.err: Frame: function:'webpackJsonpCallback', file:'file:///src/webpack/bootstrap:30:0 System.err: Frame: function:'', file:'file:///data/data/org.nativescript.phcc/files/app/bundle.js', line: 2, column: 57 System.err: Frame: function:'require', file:'', line: 1, column: 266 System.err: System.err: System.err: Error: Cannot find module '@nativescript-rtl/ui/grid-layout' System.err: at com.tns.Runtime.runModule(Native Method) System.err: at com.tns.Runtime.runModule(Runtime.java:663) System.err: at com.tns.Runtime.run(Runtime.java:655) System.err: at com.tns.NativeScriptApplication.onCreate(NativeScriptApplication.java:21) System.err: at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1165) System.err: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:6130) System.err: ... 8 more Can you please help me how to fix this issue.

Thank you.

Regards, Muhammad Adil

xlmnxp commented 5 years ago

you should delete platforms folder then install package

tns plugin add @nativescript-rtl/ui

and rebuild your project

adilsaeed31 commented 5 years ago

I tried with every possible way it's not working.

xlmnxp commented 5 years ago

you can import layouts from "@nativescript/ui"

import { GridLayout, WrapLayout, AbsoluteLayout, DockLayout, StackLayout }  from "@nativescript-rtl/ui";

or

require("@nativescript-rtl/ui").GridLayout
adilsaeed31 commented 5 years ago

I tried all the things before and now again, brother before going to any screen native script build is giving the error that module cannot find.

adilsaeed31 commented 5 years ago

If you can provide me some example with {N6} it would be awesome for me.

xlmnxp commented 5 years ago

Can you share your project with me?

I tried nativescript 6 and did not get any error: Screenshot_20190730_180444

adilsaeed31 commented 5 years ago

@xlmnxp Did you ever try this plugin in Nativescript Angular? My Project is in Nativescript Angular, If it's working for you in Angular then I will send you my code then you can analyze it then.

xlmnxp commented 5 years ago

For Angular see #2

xlmnxp commented 5 years ago

I found issue. I'll fix it

adilsaeed31 commented 5 years ago

@xlmnxp when you can fix this issue. I need to plan my project RTL task according to your fix.

xlmnxp commented 5 years ago

@adilsaeed31 I think this bug come with NativeScript 6 when you import RTL layout with specific platform will work other solution will not work:

registerElement(
  "RtlGridLayout",
  () => require("@nativescript-rtl/ui/grid-layout/grid-layout.android").GridLayout
);

I'm working to fix it

mhmdhmd commented 5 years ago

According to the last commit there should be issue #4 fixed. But I still take the same error!

I updated the package I cleared the node_modules, hooks and platforms folders and package-lock.json and webpack.config.js files I executed the npm install And I rebuilt

But nothing changed!

xlmnxp commented 5 years ago

@adilsaeed31 @mhmdhmd fixed: :smile: 📦 @nativescript-rtl/ui@0.1.2