Home > Net >  I can't run ganache in my terminal, even though it's installed
I can't run ganache in my terminal, even though it's installed

Time:03-14

It seems I have a path error, I can see proof the package installed, and I've tried it both globally and local, tried both with and w/o the -cli suffix, but zshell keeps complaining command not found

dr_frankenmiller@Bryans-MacBook-Pro ~ % npm install ganache-cli

npm WARN deprecated [email protected]: ganache-cli is now ganache; visit https://trfl.io/g7 for details

added 1 package, and audited 102 packages in 11s

2 packages are looking for funding
run npm fund for details

9 vulnerabilities (8 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.

dr_frankenmiller@Bryans-MacBook-Pro ~ % npm  ls --depth=0      
dr_frankenmiller@ /Users/dr_frankenmiller
└── [email protected]

dr_frankenmiller@Bryans-MacBook-Pro ~ % ganache-cli

zsh: command not found: ganache-cli

I might have done something bad, using a sudo rm -rf node_modules command to uninstall the package, was that dangerous to do? I reinstalled it globally and then tried running it again, and then zshell started complaining I wasn't authorized to run ganache. I tried the command sudo ganache, it asked me for password, and then responded again that command not found.

Can someone help me get back on track with my tutorial?

CodePudding user response:

According to Ganache-CLI's instructions, it should be installed with:

npm install ganache-cli -g

I'd recommend installing the latest Ganache version rather than installing Ganache-CLI, though. Ganache-CLI is deprecated. Use

npm uninstall ganache-cli && npm install ganache -g

Ganache v7.0.0 and onward can be used in the CLI as well as programatically.

On another note, I strongly recommend against using sudo when installing anything via npm. This can give untrusted code the ability to run as admin on your system. Definitely a big security risk.

CodePudding user response:

Just a follow up on difficulties I was having, I ended up using yarn to download and run ganache (MINUS the -cli suffix, -cli suffix now deprecated), yarn install ganache --global to install and then yarn ganache to run (no -cli necessary)

  • Related