Unable to install dependencies when used with yarn workspaces, when "output" is from env
Siegrift opened this issue ยท 7 comments
Hi, and thanks for this library!
I was working on a project and use yarn workspaces, one for the FE and one for the BE with Prisma. I noticed that after installing yarn add -D prisma-erd-generator @mermaid-js/mermaid-cli
I was no longer able to run yarn
to install (and neither of my coworkers).
I spent some time isolating the problem and came up with a minimal reproducible example. You can see it this repo: https://github.com/Siegrift/prisma-erd-yarn-workspaces-bug. Steps:
- Clone the repo
2.yarn
(the installation will take forever, so feel free to quit it) rm -rf node_modules ./a/node_modules/ ./b/node_modules
- Comment out line 9 of the prisma schema
- Run
yarn
again and it should install successfully
I am honestly not sure why it's behaving like this, but my fix was to ditch yarn workspaces and use npm (because npm i
works).
EDIT: prisma/prisma#5646 seemed relevant at first, but it's probably not related.
I don't use yarn workspaces but I think I understand why this would cause issues. This CLI looks for a binary file to run called mmdc
// Example of snippet searching for mmdc binary
let mermaidCliNodePath = path.resolve(
path.join('node_modules', '.bin', 'mmdc')
);
If I had to guess I'd assume this is causing issues because your root directory for node_modules might not be that path. Maybe yarn workspaces is combining all your node_modules to one directory and its a level higher than represented here. Or lower. Unsure. Would anyone be able to help me understand this more? Where this is leading me now is to add a config option to specify the path to the mmdc binary.
I thought something like that would be the cause of this issue, but I don't understand why uncommenting the ERD_FILE_PATH would resolve the issue.
Where is ERD_FILE_PATH? I don't even see that in the code. Also, any luck with passing the path to the mmdc binary?
I moved this to just be the path to mmdc. So instead of it being `mmdcPath = "node_modules/.bin/mmdc" it is
generator erd {
provider = "prisma-erd-generator"
mmcdPath = "node_modules/.bin"
}
Let me know if you still get this issue once you point to the appropriate mmdc path
Caught up on alpha release
npm i -D prisma-erd-generator@alpha
# or
npm i -D prisma-erd-generator@1.4.6
Working on catching up latest
๐ This issue has been resolved in version 1.7.0-alpha.1 ๐
The release is available on:
Your semantic-release bot ๐ฆ๐
๐ This issue has been resolved in version 1.9.0-alpha.1 ๐
The release is available on:
Your semantic-release bot ๐ฆ๐