mika-cn/maoxian-web-clipper

kubuntu install native APP error

wieniawski-lai opened this issue · 5 comments

pre-condition:

  • kubuntu22.04LTS
  • firefox
  • ruby 3.0.2p107
  • maoxian-web-clipper-native-linux-firefox-0.2.11

I have install native app, but in firefox's extension, it is reported:

「本地程序」当前不可用
错误信息: NativeApp: DisconnectErr:An unexpected error occurred
可能是由于你的「本地程序」还没有安装或者安装未成功导致的 ([查看如何安装](go.page:native-app))

BTW, under ~/.mozilla/native-messaging-hosts, there is a json file, whose containment is:

"name": "maoxian_web_clipper_native",
"description": "Native aplication of maoxian web clipper",
"path": "/opt/maoxian-firefox/main.rb",
"type": "stdio",
"allowed_extensions": ["{7deb155c-e51d-4bbb-a904-37dec499340c}"]
}

how can I solve that?

thx.

I saw your native application is installed under /opt. Do you intend to installed it there? This Native Application is better be installed under your home directory to avoid permission denied problems.

Because the unusual installation location. I can think of two possibilities that will cause this error, list below:

  • you extracted the native application under /opt, and did the installation then move, rename, or remove the native application. This will cause the browser can't find the target native application.
  • you extracted the native application under /opt, and the browser tried to execute the native application, but the native application wantted to create a logger file in path /opt/maoxian-firefox/tmp/app.log.which got permission denied.

how can I solve that?

Install it under your home directory.

en, I have moved the native app to my home directory. But I still face the same error.

I also done some experiment:

  1. after type ./install.sh, I type ps -ef | grep main*, then I did not found main.rb running.
  2. I start the native app manually, by typing ./main.rb under app directory. Then I can find main.rb running while type ps -ef | grep main*.
  3. after 2, I can found app.log under tmp, which is
# Logfile created on 2023-08-28 16:05:13 +0800 by logger.rb/v1.4.3
I, [2023-08-28T16:05:13.214842 #62915]  INFO -- : App Start
I, [2023-08-28T16:05:13.214865 #62915]  INFO -- : Version: 0.2.11
I, [2023-08-28T16:05:13.214873 #62915]  INFO -- : Ruby Version: 3.0.2
I, [2023-08-28T16:05:13.214880 #62915]  INFO -- : Msg handler: default
I, [2023-08-28T16:05:13.214886 #62915]  INFO -- : Encoding: 
I, [2023-08-28T16:05:13.214892 #62915]  INFO -- :   Script => UTF-8
I, [2023-08-28T16:05:13.214899 #62915]  INFO -- :   Locale => UTF-8
I, [2023-08-28T16:05:13.214905 #62915]  INFO -- :   Filesystem => UTF-8
I, [2023-08-28T16:05:13.214911 #62915]  INFO -- :   Default external => UTF-8
I, [2023-08-28T16:05:13.214918 #62915]  INFO -- :   Default internal => nil
I, [2023-08-28T16:05:39.950020 #62915]  INFO -- : App exit: 62915
I, [2023-08-28T16:06:11.392715 #62942]  INFO -- : App Start
I, [2023-08-28T16:06:11.392760 #62942]  INFO -- : Version: 0.2.11
I, [2023-08-28T16:06:11.392769 #62942]  INFO -- : Ruby Version: 3.0.2
I, [2023-08-28T16:06:11.392776 #62942]  INFO -- : Msg handler: default
I, [2023-08-28T16:06:11.392782 #62942]  INFO -- : Encoding: 
I, [2023-08-28T16:06:11.392788 #62942]  INFO -- :   Script => UTF-8
I, [2023-08-28T16:06:11.392795 #62942]  INFO -- :   Locale => UTF-8
I, [2023-08-28T16:06:11.392802 #62942]  INFO -- :   Filesystem => UTF-8
I, [2023-08-28T16:06:11.392808 #62942]  INFO -- :   Default external => UTF-8
I, [2023-08-28T16:06:11.392814 #62942]  INFO -- :   Default internal => nil
I, [2023-08-28T16:07:14.505163 #62942]  INFO -- : App exit: 62942
I, [2023-08-28T16:08:20.196016 #63060]  INFO -- : App Start
I, [2023-08-28T16:08:20.196054 #63060]  INFO -- : Version: 0.2.11
I, [2023-08-28T16:08:20.196063 #63060]  INFO -- : Ruby Version: 3.0.2
I, [2023-08-28T16:08:20.196070 #63060]  INFO -- : Msg handler: default
I, [2023-08-28T16:08:20.196076 #63060]  INFO -- : Encoding: 
I, [2023-08-28T16:08:20.196083 #63060]  INFO -- :   Script => UTF-8
I, [2023-08-28T16:08:20.196089 #63060]  INFO -- :   Locale => UTF-8
I, [2023-08-28T16:08:20.196095 #63060]  INFO -- :   Filesystem => UTF-8
I, [2023-08-28T16:08:20.196102 #63060]  INFO -- :   Default external => UTF-8
I, [2023-08-28T16:08:20.196108 #63060]  INFO -- :   Default internal => nil

However, I still face error in firefox extension:

「本地程序」当前不可用
错误信息: NativeApp: DisconnectErr:An unexpected error occurred
可能是由于你的「本地程序」还没有安装或者安装未成功导致的 ([查看如何安装](go.page:native-app))

above log's App exit is coursed by typing ctrl+c to terminate main.rb, which is reasonable.

en, I have dig out more.

  1. I notice that while openning maoxian's setting in firefox, the URL is moz-extension://9477edee-386e-4614-b601-c288832a838c/pages/setting.html#setting-storage
  2. I guess 9477edee-386e-4614-b601-c288832a838c is the extension's ID, which should be appeared in $HOME/.mozilla/native-messaging-hosts/maoxian_web_clipper_native.json file.
  3. However, the ID in that json file is not the same with URL's.
  4. And the ID comes from manifest.json
  5. So I changed the ID in manifest.json, and reinstall maoxian native app.
  6. At this time, the report changes:
「本地程序」当前不可用
错误信息: NativeApp: DisconnectErr:No such native application maoxian_web_clipper_native
可能是由于你的「本地程序」还没有安装或者安装未成功导致的 ([查看如何安装](go.page:native-app))
  1. after type ./install.sh, I type ps -ef | grep main*, then I did not found main.rb running.

This is totally normal, because the installation only copy the manifest.json to $HOME/.mozilla/native-messaging-hosts/ it did not start the native app. The native app is started by Firefox.

This also means manually start the native app didn't work. Native Applications should only be started by browsers, so that they can communicate to each other.


And this id {7deb155c-e51d-4bbb-a904-37dec499340c} is the right one, The id you copied from address bar is just a Internal UUID (you could find this different in url: about:debugging#/runtime/this-firefox).


From the information you provided so far, you have installed the native app. but Firefox failed to start it.

Here's how to further debug it:

  • remove the logger file first: rm tmp/app.log
  • close your firefox and start it from command line like this: /usr/bin/firefox. So you can see the loggers that printted by firefox.
  • Go to settings page of MaoXian > Native App , so that Firefox will try to start up the native app of MaoXian.

After these operations do this:

  • Check if the existence of logger file: tmp/app.log. If it's exist, then Firefox did try to run it (main.rb). All you need to do is figure out what's wrong in side tmp/app.log

  • If you couldn't find the logger file, then see the loggers that printted by Firefox. This means Firefox didn't even run the main.rb file. Something is wrong about finding the ruby, finding the main.rb or file permission is not right.