Search code examples
node.jsnpmganache

command not found: ganache-cli


I have installed and reinstalled npm to try to run ganache and it has not been successful..really need help here!


(base) user bin % npm install -g ganache-cli

changed 6 packages, and audited 102 packages in 4s

2 packages are looking for funding run npm fund for details

8 vulnerabilities (7 moderate, 1 high)

To address issues that do not require attention, run: npm audit fix

To address all issues (including breaking changes), run: npm audit fix --force

Run npm audit for details. (base) user bin % ganache-cli zsh: command not found: ganache-cli


Solution

  • The most likely cause is that the global modules installation directory is not in your path. As a quick workaround, you can run it like this:

    `npm root -g`/ganache-cli/cli.js
    

    A better idea (aside from fixing your PATH!) would be to install it as a dev dependency in the project that needs it (so npm install -D instead of npm install -g) and then run it with npx (so npx ganache-cli rather than ganache-cli).