Failure to install mermaid-cli due to missing dependency
Describe the bug
npm install --global @mermaid-js/mermaid-cli fails with the following error:
npm error code 127
npm error path /opt/hostedtoolcache/node/20.19.1/x[6](https://github.com/tektronix/python-package-ci-cd/actions/runs/14739919676/job/41375118061#step:4:7)4/lib/node_modules/@mermaid-js/mermaid-cli/node_modules/cytoscape
npm error command failed
npm error command sh -c npx playwright install
npm error npm warn exec The following package was not found and will be installed: [email protected]
npm error sh: 1: playwright: not found
To Reproduce Steps to reproduce the behavior:
Run npm install --global @mermaid-js/mermaid-cli on a clean system
Expected behavior
mermaid-cli should install properly.
Additional context GitHub Workflow build where the problem occurred: https://github.com/tektronix/python-package-ci-cd/actions/runs/14739919676/job/41375118061
I was also able to reproduce it in a clean WSL Ubuntu environment
I am getting the same issue on npm 8.3.1 using WSL. What version of npm are you using?
I am using npm 10.9.0
npm error command sh -c npx playwright install
message appears on the console, so it looks like there is an error installing playwright. I noticed this problem when running "npm -g update".
Removing the global flag worked for me
I also confirmed that the error can be avoided by removing the global option. We need to avoid global installations as a workaround for the time being.
In my case, my OS is Ubuntu MATE 25.04, but I found out that playwright only supports up to 24.10 on Ubuntu-based OS, which is why errors occur when updating or installing. This issue may not be resolved until Microsoft supports playwright up to 25.04.
I'll explain in more detail. Playwright depends on libicu74. However, the libicu in Ubuntu 25.04 is libicu76. As a result, the dependency is not met, which is likely why an error occurs in playwright.
This worked for me:
npm install -g @playwright/[email protected] @mermaid-js/mermaid-cli
Seems that playwright version 1.53 is the issue.
It looks like this issue no longer happens now. I was able to install on wsl with no changes to the command necessary
I am currently reproducing it on Ubuntu MATE 25.04.
Reproduction environment:
OS : Ubuntu MATE 25.04 Plucky Puffin
NodeJS : v20.18.1
npm : 9.2.0
Need more information?
Looks like we have to read the URL below. https://www.npmjs.com/package/@mermaid-js/mermaid-cli/v/8.9.1#install-globally
The issue was with cytoscape and has been fixed now: https://github.com/cytoscape/cytoscape.js/issues/3368
However, I don't think this dependency has been updated since.
One workaround is to add an explicit dependency to package.json:
"cytoscape": "3.31.4",
Then as soon as it is added to the package-lock.json file it can be removed from the package.json.