简体   繁体   English

"找不到命令:ganache-cli"

[英]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

OR或者

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

相关问题 带有 ganache-cli 的 web3.eth.getTransaction 给出了 chainId 错误 - web3.eth.getTransaction with ganache-cli gives chainId error npm全局安装ganache-cli失败(由于sudo / permissions) - npm global install of ganache-cli fails (because of sudo/permissions) 使用 Ganache-Cli、Mocha、Web3、Solc 0.8.6 编译器运行智能合约 - Running smart contract using Ganache-Cli, Mocha, Web3, Solc 0.8.6 compiler 我运行了 ganache-cli,它返回了一个错误。 我已经重新安装了 npm 并且什么也没做 - I ran ganache-cli and it returned an error. i've reinstall npm and nothing done 找不到 lb(环回 cli)命令 - MacOS - lb (loopback cli) command not found - MacOS 安装grunt和grunt cli后找不到grunt命令 - grunt command not found after installed grunt and grunt cli ng:安装节点和角度cli后找不到命令 - ng: command not found after installing node and angular cli Expo-cli 已安装,但“-bash: expo: command not found” - Expo-cli is installed but “-bash: expo: command not found” 如何修复放大 CLI 错误:“-bash:放大:找不到命令” - How to fix amplify CLI error : "-bash: amplify: command not found" “-bash: expo: command not found” 安装 expo-cli 后 - “-bash: expo: command not found” after installing expo-cli
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM