Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command failed when i try generator #123

Open
lokize opened this issue Aug 17, 2022 · 29 comments
Open

Command failed when i try generator #123

lokize opened this issue Aug 17, 2022 · 29 comments
Labels
help wanted Extra attention is needed

Comments

@lokize
Copy link

lokize commented Aug 17, 2022

Hi, i have this error when i try run npx prisma generate, I can run with the md extension but when I try to use png or svg this error occurs

image

@keonik
Copy link
Owner

keonik commented Aug 18, 2022

Hey @lokize this might be a duplicate issue so could you share your OS, node version, and do some validation to see if that path to mmdc engine exists?

/root/developer/Exp/Area-do-Cliente-Ceres-Sistemas/node_modules/.bin/mmdc

@lokize
Copy link
Author

lokize commented Aug 18, 2022

thanks for help, yes the path exists, when i try gerenate with extension ".md" this worked

@keonik
Copy link
Owner

keonik commented Aug 18, 2022

That’s the confusing part. When you run with the output file as .md it skips calling that script because we’ve already translated the prisma dml to mermaid and it gets written straight to file. Any other formats get run through this script. Do another check to make sure that exists in the directory

@lokize
Copy link
Author

lokize commented Aug 18, 2022

i checked again and the folder and path exists...

@keonik
Copy link
Owner

keonik commented Aug 18, 2022

Okay cool. Go ahead and enable debug mode and take a look at your generated mermaid file in step 3 outputted to prisma/debug/3-.... If it works in markdown it should work through the mermaid CLI so try to call the CLI manually and ensure it generates your svg/png etc. They don't really show much for debugging if it fails in the CLI. Depending on if you get through manually calling the CLI we would keep troubleshooting or open an issue with mermaid cli.

@keonik
Copy link
Owner

keonik commented Aug 18, 2022

Share your OS and node version as well. Most of these failures are happening for windows users

@lokize
Copy link
Author

lokize commented Aug 18, 2022

i using wsl2 with CentOS9 Stream, nvm with nodejs v16.16.0

@keonik keonik added the help wanted Extra attention is needed label Aug 19, 2022
@d0lb33
Copy link

d0lb33 commented Oct 11, 2022

Same error here, I ran the command manually and it seems to be a puppeteer issue.
image

@d0lb33
Copy link

d0lb33 commented Oct 11, 2022

I ran:
sudo apt-get install -y libgbm-dev

And now I get this error:
image

Node Version: v16.17.1
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"

@d0lb33
Copy link

d0lb33 commented Oct 11, 2022

So what worked for me was following the mermaid readme:
image

I made this file and added it to my manual command.

@Sephyros
Copy link

Sephyros commented Nov 3, 2022

I had the same problem as the author of the issue, I use Windows 11 with WSL2 (Ubuntu 22.04.1 - 5.15.68.1-microsoft-standard-WSL2) and I didn't have any special characters or spaces in the path, everything was resolved when I installed the lib " libasound2", don't ask me what this library has to do with an svg generator, but as I said, that's what solved it.

@pmdpaula
Copy link

pmdpaula commented Nov 4, 2022

I've tried everything above and what worked for me was:
sudo apt-get install libxkbcommon-x11-0

I'm using Win10 WSL2 Ubuntu22.02
Node v18.12.0

@meli-tortelli
Copy link

meli-tortelli commented Nov 5, 2022

i've tried your solution @pmdpaula and @Sephyros but both didn't worked for me, i'm still having the same issue. there's another thing that i can try to do to solve this?
i'm using windows 11 with WSL Ubuntu v22.04.1, nvm with node v18.12.0

image

@meli-tortelli
Copy link

i solved already. i guess it was a duplicate module issue with the prisma generator-helper. i just had to remove the module, run yarn install and then ran again npx prisma generate.

so if anyone is having this same issue maybe try to do the same.

image

@pmdpaula
Copy link

pmdpaula commented Nov 5, 2022

i solved already. i guess it was a duplicate module issue with the prisma generator-helper. i just had to remove the module, run yarn install and then ran again npx prisma generate.

so if anyone is having this same issue maybe try to do the same.

image

It didn't work for me. I've tried it before.

@Siegrift
Copy link

Siegrift commented Nov 9, 2022

I experienced a similar issue but my error cause (and also fix) was different. I ran the failed command myself to see what is the error.

Error: Could not find expected browser (chrome) locally. Run `npm install` to download the correct Chromium revision (1045629).
    at ChromeLauncher.launch (file:///Users/emanueltesar/vacuumlabs/api3/oev-relay/node_modules/puppeteer-core/lib/esm/puppeteer/node/ChromeLauncher.js:64:23)
    at async run (file:///Users/emanueltesar/vacuumlabs/api3/oev-relay/node_modules/@mermaid-js/mermaid-cli/src/index.js:343:19)
    at async cli (file:///Users/emanueltesar/vacuumlabs/api3/oev-relay/node_modules/@mermaid-js/mermaid-cli/src/index.js:138:3)

and the fix that worked for me was: https://stackoverflow.com/a/60843949

@lokize
Copy link
Author

lokize commented Dec 3, 2022

I still have this problem only work with md extension when i try using png, pdf or svg not worked.

@segheysens
Copy link

On MacOS, this just seemed to be a permissions issue and the command worked (after previously failing) but just using sudo.

@maiconloure
Copy link

sudo apt-get install -y libgbm-dev
Above command fixed my problem.

@keonik
Copy link
Owner

keonik commented Mar 21, 2023

Did everyone find a resolution on this? As far as I'm seeing it, puppeteer support for node v18 is not there yet. As a workaround we can run the generator and utilize markdown export only.

Options

  • Downgrade to node v16
  • Export to .md file
  • Try various install suggestions to get node 18 working or update libraries on your computer
    libgbm-dev, libxkbcommon, etc.

@kraighamady
Copy link

kraighamady commented Apr 25, 2023

I just got this error today.
Windows 10, Node 19.8.1.
Was working yesterday and today I got the same issue as above. No changes to my system, just to my schema.

EDIT: Ends up some system process locked up the svg file. Rebooted and it released the file and it worked again.

@sKawashima
Copy link

sKawashima commented Jul 12, 2023

I got the same error too.
It was Mac OS, Node 18.

After reinstalling Chromium it worked fine.
On M1Mac I had to run xattr -rc /Applications/Chromium.app.

When executing the command, it acted like it was trying to start Chromium, so I reinstalled it and executed the above command.

https://github.com/keonik/prisma-erd-generator#-arm64-users-

@keonik
Copy link
Owner

keonik commented Aug 10, 2023

@lokize were you able to figure a solution? This issue turned into a good troubleshooting guide of ideas for each OS. I might pin it for reference

@nicel3d
Copy link

nicel3d commented Aug 14, 2023

For Windows11 and wsl2.
The transition from version 1.8.0 to 1.11.0 caused an error in generating the svg file, creating my own puppeteerConfig.json solved the problem:

schema.prisma

generator erd {
  provider        = "prisma-erd-generator"
  output          = "./ERD.svg"
  puppeteerConfig = "./puppeteerConfig.json"
}

puppeteerConfig.json

{ "logLevel": "error" }

@fullstackzach
Copy link

fullstackzach commented Aug 16, 2023

@nicel3d's solution worked for me and was straightforward! I'm on mac

here's my config

generator erd {
  provider        = "prisma-erd-generator"
  puppeteerConfig = "./prisma/puppeteerConfig.json"
}

@akd-io
Copy link

akd-io commented Aug 30, 2023

I'm hitting this problem too. It works fine locally on my Mac, but I'm getting errors in my GitHub workflow:

> prisma generate

Prisma schema loaded from prisma/schema.prisma
Error: 
✔ Generated Prisma Client (v5.2.0) to ./prisma/generated/prisma-client in 186ms

Command failed: "/home/runner/work/redacted/redacted/node_modules/.bin/mmdc" -i "/tmp/prisma-erd-wvWwyT/prisma.mmd" -o "/home/runner/work/redacted/redacted/prisma/generated/ERD.svg" -c "/tmp/prisma-erd-wvWwyT/config.json" -p "/tmp/prisma-erd-wvWwyT/puppeteerConfig.json"


 ELIFECYCLE  Command failed with exit code 1.

My prisma.schema includes:

generator client {
  provider = "prisma-client-js"
  binaryTargets = ["native", "rhel-openssl-1.0.x", "debian-openssl-1.1.x"]
  output = "./generated/prisma-client"
}

generator erd {
  provider = "prisma-erd-generator"
  output = "./generated/ERD.svg"
}

The fix by @nicel3d (with @fullstackzach's path) doesn't work for me. I get:

> prisma generate

Prisma schema loaded from prisma/schema.prisma
Error: 
✔ Generated Prisma Client (v5.2.0) to ./prisma/generated/prisma-client in 190ms

Command failed: "/home/runner/work/redacted/redacted/node_modules/.bin/mmdc" -i "/tmp/prisma-erd-yYaL7c/prisma.mmd" -o "/home/runner/work/redacted/redacted/prisma/generated/ERD.svg" -c "/tmp/prisma-erd-yYaL7c/config.json" -p "./prisma/puppeteerConfig.json"


 ELIFECYCLE  Command failed with exit code 1.

@cyrus-za
Copy link

I get that same error when trying to build it on vercel. Works locally though

@keonik
Copy link
Owner

keonik commented May 13, 2024

I get that same error when trying to build it on vercel. Works locally though

@cyrus-za Do you need or want it to run on the build within vercel?

@akd-io for you and @cyrus-za we need to work backwards to see if mmdc exists, then enable debugging logs to see why the command is failing.

If you are okay with just publishing to the git repository I recommend adding ERD_DISABLE to the github job or the vercel build job. On the off chance you're trying to serve the SVG within the project you do probably need it in which I'd recommend going down that mmdc location and log enabling route.

@cyrus-za
Copy link

cyrus-za commented Jun 6, 2024

yes trying to serve the svg on a standalone vercel project that run within the same monorepo. That way we always got an up to date svg hosted at a url that we can open during architecture meetings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests