mermaid-cli icon indicating copy to clipboard operation
mermaid-cli copied to clipboard

Failure to install mermaid-cli due to missing dependency

Open nfelt14 opened this issue 7 months ago • 14 comments

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

nfelt14 avatar Apr 29 '25 20:04 nfelt14

I was also able to reproduce it in a clean WSL Ubuntu environment

nfelt14 avatar Apr 29 '25 20:04 nfelt14

I am getting the same issue on npm 8.3.1 using WSL. What version of npm are you using?

Spiph avatar Apr 29 '25 21:04 Spiph

I am using npm 10.9.0

nfelt14 avatar Apr 29 '25 21:04 nfelt14

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".

mitsugu avatar Apr 29 '25 22:04 mitsugu

Removing the global flag worked for me

Spiph avatar Apr 30 '25 00:04 Spiph

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.

mitsugu avatar Apr 30 '25 03:04 mitsugu

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.

mitsugu avatar Apr 30 '25 06:04 mitsugu

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.

mitsugu avatar Apr 30 '25 06:04 mitsugu

This worked for me:

npm install -g @playwright/[email protected] @mermaid-js/mermaid-cli

Seems that playwright version 1.53 is the issue.

klemmari1 avatar Apr 30 '25 09:04 klemmari1

It looks like this issue no longer happens now. I was able to install on wsl with no changes to the command necessary

nfelt14 avatar May 01 '25 18:05 nfelt14

I am currently reproducing it on Ubuntu MATE 25.04.

mitsugu avatar May 01 '25 20:05 mitsugu

Reproduction environment:

OS : Ubuntu MATE 25.04 Plucky Puffin
NodeJS : v20.18.1
npm : 9.2.0

Need more information?

mitsugu avatar May 01 '25 21:05 mitsugu

Looks like we have to read the URL below. https://www.npmjs.com/package/@mermaid-js/mermaid-cli/v/8.9.1#install-globally

mitsugu avatar May 02 '25 04:05 mitsugu

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.

terlar avatar Jul 03 '25 22:07 terlar