krushkamx / nativescript-hprt

Print to thermal printers from HPRT in your Nativescript application https://www.hprt.com/
MIT License
29 stars 16 forks source link

Cannot connect to printer #11

Closed bbc91 closed 5 years ago

bbc91 commented 5 years ago

I'm using nativescript vue with webpack.

The module is installed, and searchPrinters() is working, but when I try to connect a printer I got this error:

'Connect error' [Error: com.tns.NativeScriptException: Failed to find module: "./workers/connect-printer", relative to: app// JS: com.tns.Module.resolvePathHelper(Module.java:146) JS: com.tns.Module.resolvePath(Module.java:55) JS: com.tns.Runtime.callJSMethodNative(Native Method) JS: com.tns.Runtime.dispatchCallJSMethodNative(Runtime.java:1116) JS: com.tns.Runtime.callJSMethodImpl(Runtime.java:996) JS: com.tns.Runtime.callJSMethod(Runtime.java:983) JS: com.tns.Runtime.callJSMethod(Runtime.java:967) JS: com.tns.Runtime.callJSMethod(Runtime.java:959) JS: com.tns.gen.android.content.DialogInterface_OnClickListener.onClick(DialogInterface_OnClickListener.java:17) JS: com.android.internal.app.AlertController$AlertParams$3.onItemClick(AlertController.java:1168) JS: android.widget.AdapterView.performItemClick(AdapterView.java:321) JS: android.widget.AbsListView.performItemClick(AbsListView.java:1217) JS: android.widget.AbsListView$PerformClick.run(AbsListView.java:3203) JS: android.widget.AbsListView$3.run(AbsListVi...

I don't know if it is a bug or I'm not using it correctly, but I will be grateful for solution suggestions.

ChobitsSP commented 5 years ago

https://github.com/krushkamx/nativescript-hprt/issues/4

ChobitsSP commented 5 years ago

https://github.com/ChobitsSP/nativescript-hprt-vue-demo

davorpeic commented 5 years ago

@bbc91 Hi, you need to add workers in your project normally in your app/workers/ folder, I updated the docs for use with workers and wbepack, check it out https://github.com/krushkamx/nativescript-hprt#working-with-workers

prabhushan commented 3 years ago

Hi,

I added the config as mentioned in the above documentation.. I also see it is getting copied in webpack.. but still same issue

` Asset Size Chunks Chunk Names app/workers/connect-printer.js 321 bytes [emitted]
bundle.js 43.6 KiB bundle [emitted] bundle package.json 2.31 KiB [emitted]
runtime.js 77.1 KiB runtime [emitted] runtime tns-java-classes.js 0 bytes [emitted]
vendor.js 17.2 MiB vendor [emitted] vendor Entrypoint bundle = runtime.js vendor.js bundle.js [../$$_lazy_route_resource lazy recursive] ../$$_lazy_route_resource lazy namespace object 160 bytes {bundle} [built] [./app.css] 1.2 KiB {bundle} [built] [./app/app-routing.module.tns.ts] 1.39 KiB {bundle} [built] [./app/app.component.tns.ts] 7.25 KiB {bundle} [built] [./app/app.module.tns.ts] 1.73 KiB {bundle} [built] [./app/auto-generated/auto-generated.component.ts] 1.15 KiB {bundle} [built] [./main.tns.ts] 2.31 KiB {bundle} [built] [~/package.json] external "~/package.json" 42 bytes {bundle} [optional] [built]