asciidoctor / asciidoctor-intellij-plugin

AsciiDoc plugin for products on the IntelliJ platform (IDEA, RubyMine, etc)
https://intellij-asciidoc-plugin.ahus1.de/
Apache License 2.0
342 stars 145 forks source link

Asciidoctor Diagram in the Plugin works not correctly on macOS #1086

Open fsamland opened 2 years ago

fsamland commented 2 years ago

Hello all I tried to use the asciidoctor diagram with the plugin. I loaded the Extension and tried to generate an inline BPMN Diagram with the bpmn-js-cmd extension. At first there was some confusion about the attribute for the path to the external tool. Documentions saysbpmn the error messages says bpmn-js which was right. After that the extension is found but cannot start because og the following error: Failed to generate image: bpmn-js failed: env: node: No such file or directory This seems that node cannot be found but on console it works properly. My question: Have I to do some additional configuration inside the plugin to get node into the path? Best Regards Friedbert

ahus1 commented 2 years ago

Thanks for raising this. Sometime the path issues are most common on macOS where the IDE has different environment settings than a shell. Which OS do you use?

fsamland commented 2 years ago

Hi ahus1, sorry for missing the Environment infos. Here they are: I'm using macOS 12.4 with Intellij 2022.1.3 Ultimate and Plugin Version V037.27 (snice this morning)

ahus1 commented 2 years ago

Hi - there was some discussion in this issue #972 about environment variables on macOS. As I am not using macOS, I am not really able to help here.

When you get it working, I'd be happy if you could post your solution here, and maybe even update the plugin's documentation.

ahus1 commented 2 years ago

If the issue I linked above doesn't solve it for you, please search in the Asciidoctor's Zulip community if a similar question has been answered there already. If it hasn't, raise the question there.

Again, if you get it working, I'd be happy if you could post your solution here, and maybe even update the plugin's documentation.

ABeltramo commented 2 years ago

I'm hitting the same issue but for mermaid diagrams, I tried setting the Attributes like suggested on the linked issue, see:

Screenshot 2022-07-03 at 12 31 03

Unfortunately this doesn't fix the issue, I'm still getting:

Failed to generate image: index.bundle.js failed: env: node: No such file or directory

OSX: 11.5.2 Intellij: 2022.1.3 AsciiDoc: 0.37.27

ahus1 commented 2 years ago

Setting such an attribute works for the first executable being called (here: the binary for mermaid, or the dot executable for other diagrams). Once mermaid has been called, it then needs node, and as far as I know it expects it to be on the path, which has its own particularities on macOS as described in the other ticket.

An intermediate workaround could be to activate Kroki, which supports mermaid diagrams. Kroki is a cloud service that will render your diagrams. Users can install their own Kroki instances as a docker container (even run it locally) if they don't want to use a public cloud service.

ABeltramo commented 2 years ago

Thanks for the fast reply and for working on this plugin, I really like it!

I'll try using kroki in the meantime, sounds like a good workaround to me.

fsamland commented 2 years ago

Hello all together, sorry for the late reply but i was not online during the weekend. Thx for your investigations an i will have a look into the mentioned issue #972 , and give feed back if it solves the problem.

fsamland commented 2 years ago

Hi here some more information in the screenshot I found this morning

image

I don't if this give more insights where the error occurs? From point of view it looks like the it cannot resolve the path to my node installation (which is in /usr/local/bin an contained in $PATH) So if there is a possibilty to set an attribute for node like it helped in #972 for graphvizdot give me a hint.

fsamland commented 2 years ago

Actually I got it running with Kroki for bpmn and plantuml. But I am further interested in a solution without kroki

fsamland commented 2 years ago

So I am back now with to give some update what had happened with this issue.

  1. It worked properly for BPMN, PlantUml when I use kroki with referenced BPMN and inline PlantUML
  2. The rendereing in the preview is very good
  3. But now it worked not with antora and kroki during antora site generation. I Asked at the kroki forum(https://github.com/Mogztter/asciidoctor-kroki/issues/378) and got the Answer to use resource ID example$ for referenced BPMN files and it worked directly, but now I get render errors in the plugins preview:
    org.jruby.exceptions.SystemCallError: (ENOENT) No such file or directory -
    Users/a3667404/Development/TroubleTicketProcessing/docs/modules/ROOT/pages/:example$TroubleTicketProcessing_processTroubleTicket.bpmn

    It looks like the plugin cannot resolve the resourceID example$. Possibly I only missed some configuration. Best Regards Friedbert

fsamland commented 2 years ago

Sorry I closed the wrong issue so I had to reopen

fsamland commented 2 years ago

So I solved the antora vs Plugin issue myself. I now get a nicely preview and properly generated site when I use Kroki. At least there ist only the environmental problem on macOS open.

ahus1 commented 1 year ago

It would be great if someone with MacOS experience could summarize this for the docs.

ahus1 commented 1 year ago

As part of #1199 there is now experimental Mermaid support bundled into the plugin in a first pre-release. No installation of Node is necessary for this, as it is rendered as part of the preview.

Please comment on the other issue with your feedback when you tried it.