[英]sh: hardhat: command not found when installing Hardhat
Trying to build a project with Hardhat, I have node v15.14.0, and ran the following commands:尝试使用 Hardhat 构建项目,我有节点 v15.14.0,并运行以下命令:
npm init -y
npm 初始化-y
npm install --save-dev hardhat
npm 安装 --save-dev 安全帽
Terminal gives me:终端给了我:
Then I ran:然后我跑了:
npx hardhat
npx 安全帽
But got an error saying:但是有一个错误说:
sh: hardhat: command not found
sh:hardhat:找不到命令
Running npm install --save-dev hardhat
again did it for me.再次运行
npm install --save-dev hardhat
为我做了。
You should use NPX.您应该使用 NPX。 The Node Package eXecute allows us to directly access and execute a package stored (or not) in
$./node_modules/.bin/your-package
.节点 Package eXecute 允许我们直接访问和执行存储(或不存储)在
$./node_modules/.bin/your-package
中的 package。
Using npx hardhat [GLOBAL OPTIONS] <TASK>
everything will works fine!使用
npx hardhat [GLOBAL OPTIONS] <TASK>
一切正常!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.