terrastruct / d2

D2 is a modern diagram scripting language that turns text to diagrams.
https://d2lang.com
Mozilla Public License 2.0
17.16k stars 425 forks source link

error | nonexistent pipe error on export to png (Windows) #660

Open TSSlade opened 1 year ago

TSSlade commented 1 year ago
/planning$ d2 process.d2 process.png
node:events:368
      throw er; // Unhandled 'error' event
      ^

Error: EPIPE: broken pipe, write
    at Socket._write (node:internal/net:55:25)
    at writeOrBuffer (node:internal/streams/writable:389:12)
    at _write (node:internal/streams/writable:330:10)
    at Socket.Writable.write (node:internal/streams/writable:334:10)
    at PipeTransport.send (C:\Users\tslade\AppData\Local\ms-playwright-go\1.20.0-beta-1647057403000\package\lib\protocol\transport.js:54:21)
    at DispatcherConnection.dispatcherConnection.onmessage (C:\Users\tslade\AppData\Local\ms-playwright-go\1.20.0-beta-1647057403000\package\lib\cli\driver.js:67:57)
    at DispatcherConnection.dispatch (C:\Users\tslade\AppData\Local\ms-playwright-go\1.20.0-beta-1647057403000\package\lib\dispatchers\dispatcher.js:370:10)
Emitted 'error' event on Socket instance at:
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -4047,
  syscall: 'write',
  code: 'EPIPE'
}
The process tried to write to a nonexistent pipe.
err: failed to launch Chromium: could not send message: could not send message to server: Timeout 30000ms exceeded.
TSSlade commented 1 year ago

Happened with node version 17.9.0 installed.

Updated node to 19.4.0 and got this result:

planning$ d2 process.d2 process.png
err: failed to launch Chromium: could not send message: could not send message to server: Timeout 30000ms exceeded.

Is there an undocumented verbose flag that can be used for troubleshooting?

alixander commented 1 year ago

this looks like a Playwright issue, which is what we use to convert SVG to PNG. Can you try reinstalling their dependencies? https://playwright.dev/docs/cli#install-system-dependencies

TSSlade commented 1 year ago

Not sure if this is a Windows git bash issue, or what. But I can (apparently successfully) install playwright...

/planning$ npm init playwright@latest
Getting started with writing end-to-end tests with Playwright:
Initializing project in '.'
√ Do you want to use TypeScript or JavaScript? · TypeScript
√ Where to put your end-to-end tests? · e2e
√ Add a GitHub Actions workflow? (y/N) · false
√ Install Playwright browsers (can be done manually via 'npx playwright install')? (Y/n) · true
Installing Playwright Test (npm install --save-dev @playwright/test)…

up to date, audited 4 packages in 1s

found 0 vulnerabilities
Downloading browsers (npx playwright install)…
√ C:\Users\tslade\Documents\projects\ird-besci\planning\playwright.config.ts already exists. Override it? (y/N) · true
Writing playwright.config.ts.
Writing e2e\example.spec.ts.
√ C:\Users\tslade\Documents\projects\ird-besci\planning\tests-examples\demo-todo-app.spec.ts already exists. Override it? (y/N) · true

Writing tests-examples\demo-todo-app.spec.ts.
Writing package.json.
✔ Success! Created a Playwright Test project at C:\Users\tslade\Documents\projects\ird-besci\planning

Inside that directory, you can run several commands:

  npx playwright test
    Runs the end-to-end tests.

  npx playwright test --project=chromium
    Runs the tests only on Desktop Chrome.

  npx playwright test example
    Runs the tests in a specific file.

  npx playwright test --debug
    Runs the tests in debug mode.

  npx playwright codegen
    Auto generate tests with Codegen.

We suggest that you begin by typing:

    npx playwright test

And check out the following files:
  - .\e2e\example.spec.ts - Example end-to-end test
  - .\tests-examples\demo-todo-app.spec.ts - Demo Todo App end-to-end tests
  - .\playwright.config.ts - Playwright Test configuration

Visit https://playwright.dev/docs/intro for more information. ✨

Happy hacking! 🎭

...and still get no joy:

planning$ d2 process.d2 process.png
←[31merr←[0m: failed to install Playwright: could not install driver: could not install driver: could not check if driver is up2date: could not run driver: exit status 1

I think I fundamentally don't understand the execution model here, because the npx playwright install-deps command immediately fails:

planning$ npx playwright install-deps
& : The term 'C:\Users\tslade\AppData\Local\Temp\_MEI262282\Scripts\conda.exe' is not recognized as the name of a cmdlet, function,
script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At C:\Users\tslade\Documents\WindowsPowerShell\profile.ps1:4 char:4
+ (& "C:\Users\tslade\AppData\Local\Temp\_MEI262282\Scripts\conda.exe"  ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (C:\Users\tslade...ripts\conda.exe:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
TSSlade commented 1 year ago

...and of course there's no standalone playwright executable per se that I can make sure is in the PATH, right? At least AFAICT from the documentation.