[英]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!我已经安装并重新安装了 npm 以尝试运行 ganache,但它没有成功..这里真的需要帮助!
(base) user bin % npm install -g ganache-cli (基本)用户 bin % npm install -g ganache-cli
changed 6 packages, and audited 102 packages in 4s更换6个包,4s审核102个包
2 packages are looking for funding run npm fund
for details 2 包正在寻找资金 run
npm fund
了解详情
8 vulnerabilities (7 moderate, 1 high) 8 个漏洞(7 个中等,1 个高)
To address issues that do not require attention, run: npm audit fix要解决不需要注意的问题,请运行:npm audit fix
To address all issues (including breaking changes), run: npm audit fix --force要解决所有问题(包括重大更改),请运行: npm audit fix --force
Run npm audit
for details.运行
npm audit
以获取详细信息。 (base) user bin % ganache-cli zsh: command not found: ganache-cli (基本)用户 bin % ganache-cli zsh:找不到命令: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
).一个更好的想法(除了固定的路径!)。将它安装在项目中的一个开发依赖需要它(所以
npm install -D
,而不是npm install -g
),然后运行它npx
(所以npx ganache-cli
而不是ganache-cli
)。
For Win10: update PATH env variable adding对于 Win10:更新 PATH 环境变量添加
C:\Users\myUserName\AppData\Local\Yarn\bin
In that dir I have 2 files:在那个目录中,我有 2 个文件:
ganache-cli
ganache-cli.cmd
if you are on linux(my case ubuntu) and you encoutered this issue.如果您使用的是 linux(我的情况是 ubuntu)并且遇到了这个问题。 you should try
你应该试试
$sudo npm install -g ganache
$sudo yarn global add ganache
This is probably because you used sudo privileges to install npm and yarn in first place.这可能是因为您首先使用 sudo 权限安装了 npm 和 yarn。 happy hacking :)
快乐的黑客:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.