简体   繁体   中英

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

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

For Win10: update PATH env variable adding

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

In that dir I have 2 files:

ganache-cli
ganache-cli.cmd

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM