How to Fix Npx Hardhat Issues

How to Fix Npx Hardhat Issues

Hardhat is a development environment to compile, deploy, test, and debug your Ethereum software. It helps developers manage and automate the recurring tasks that are inherent to the process of building smart contracts and dApps, as well as easily introducing more functionality around this workflow.

This is a guide on how you can fix npx hardhat Issues while installing Hardhat and Creating your Smart Contract (Hardhat project ). You will most likely run into this npx hardhat issue, after installing your hardhat and when you want to run npx hardhat

 Issue  after running: npx hardhat

Hard Hat2.JPG

If you encounter the above issue, then this is how you can fix it. I had a similar issue and spent hours troubleshooting it.

What is the cause of this issue?

One of the main causes of this issue is if you have your Project folder in the same folder that contains your node_modules. The node_modules are from the global installation of node.js npm packages. This module is located in this path in your PC, C:/users/your-PC name. This is what I mean

this path=>  C:\Users\Mars Ifeanyi

In my case, it was located at \Mars Ifeanyi.

How to Solve or Avoid this issue

To avoid this issue just make sure that your project folder is NOT in the same folder as your node_modules. You can choose the path C: or C:\Users for your Project folder.

Preferably use any of this paths, C: or Desktop or Document for creating your project folder, because you might not be able to create a folder in this path C:\Users

When you have set up your project folder properly, then follow the instructions in this article (Building With HardHat) or in the official hardhat documentation and your installation should workly properly.

Welcome to Hardhat, More Clean Codes!!!

If you have Further issues with Hardhat, You can drop it in the comment section or reach out to me on LinkedIn, https:// LinkedIn.com/in/marcellus-ifeanyi, I will be glad to help out

HVV.JPG