windranger-io / windranger-governance

BitDAO Governance contracts framework
Apache License 2.0
20 stars 10 forks source link

[Bug] Plant UML script failing #54

Closed CjHare closed 3 years ago

CjHare commented 3 years ago

Bug Description

Plant UML script is failing when run on my MacOS dev machine.

Steps to Reproduce

After a fresh install:

npm install
npm prepare
npm run build
npm run plant

Results in script failure, with the image files all empty (zero bytes in size)

Current Behaviour

 ~#@❯  npm run plant                                                                                                                                         ❮  

> bitdao-governance@1.0.0 plant
> node ./scripts/plantuml.mjs ./docs/flows/flows.puml

starting:./docs/flows/images/flows/flows.puml-plantuml-image-0.png
starting:./docs/flows/images/flows/flows.puml-plantuml-image-1.png
starting:./docs/flows/images/flows/flows.puml-plantuml-image-2.png
starting:./docs/flows/images/flows/flows.puml-plantuml-image-3.png
starting:./docs/flows/images/flows/flows.puml-plantuml-image-4.png
starting:./docs/flows/images/flows/flows.puml-plantuml-image-5.png
./docs/flows/flows.puml: generated image 0 of 5 to ./docs/flows/images/flows/flows.puml-plantuml-image-0.png
node:events:368
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:98:16)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}
CjHare commented 3 years ago

Experimented with the script version in PR, still no success.

This might be promises and timings related 🤔

CjHare commented 3 years ago

PlantUML does generate anything. Tried with different project (windranger-treasury), even with the sample with stdin, suspect the culprit may be the Node version

 ~#@❯  node --version                                                                                                                    
v17.0.1

One line stdin example from https://www.npmjs.com/package/node-plantuml

 ~#@❯  npx puml generate --unicode --text "A -> B: Hello"

Nothing is rendered.

In the script , when debugging with log lines, has data feeding into the out pipe (i.e. input content is correct), but nothing get written. 🤔

CjHare commented 3 years ago

Found the problem!

The PlantUML npm package is wrapping the PlantUML jar, meaning java needs to be accessible on the system.

After install Java the script worked (generating the images)

shahankhatch commented 3 years ago

Great. Closing this because I believe main now includes the java requirement in the readme.