YAL
YAL

Reputation: 691

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

Upvotes: 6

Views: 6461

Answers (3)

goodnews john
goodnews john

Reputation: 423

if you are on linux(my case ubuntu) and you encoutered this issue. you should try

    $sudo npm install -g ganache

OR

    $sudo yarn global add ganache

This is probably because you used sudo privileges to install npm and yarn in first place. happy hacking :)

Upvotes: 6

JDOaktown
JDOaktown

Reputation: 4467

For Win10: update PATH env variable adding

C:\Users\myUserName\AppData\Local\Yarn\bin

FYI: In that dir there are 2 files:

ganache-cli
ganache-cli.cmd

Upvotes: 5

Trott
Trott

Reputation: 70085

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

Upvotes: 9

Related Questions