This error normally comes in windows. As Native development of substrate is not very well supported in windows so you will face errors now and then. But there is a permanent solution for the same.
As we all know Substrate development is easiest on Unix-based operating systems like macOS or Linux.
So we will convert our windows into Linux without installing any new software just by Enabling some inbuilt windows feature.
First of all, prepare your windows system for the substrate. This can be done using windows subsystem Linux(wsl). To use it go into the control panel > programs > programs and Features > Turn windows Feature On or OFF,
And in it tick mark on Hyper-V and windows subsystem for Linux as shown in the images below.
After that Enable the virtualization by going into the bios advance section on your laptop. To access bios on different laptops there is a different process. So look on youtube for how to Enable virtualization on your system.
If you have a home edition of windows, Hyper-V might not be there so first install that. To install hyper-v follow the below instruction:
- Open Notepad and paste the below-given code as shown below:
dir /b %SystemRoot%\servicing\Packages\*Hyper-V*.mum >hv.txt
for /f %%i in ('findstr /i . hv.txt 2^>nul') do dism /online /norestart /add-package:"%SystemRoot%\servicing\Packages\%%i"
Dism /online /enable-feature /featurename:Microsoft-Hyper-V -All /LimitAccess /ALL
- After that in the notepad where you have pasted the code select 'Save as' and then name the file as hyper-v.bat and below that in 'save as type' select All Files and save it on the desktop or wherever you can easily find it.
- Then run that file as administrator
It will ask you to restart your system and Hyper-v will be installed on your system.
After all the above is done go into the windows app store and search wsl. You will se multiple options. There select Ubuntu 20.04.4 LTS (or whatever you like) and download it as it's famous and normally used.
And in ubuntu set username and password. Username should follow [a-z,0-9] only.
After that follow the instructions on this doc: https://docs.substrate.io/v3/getting-started/installation/#ubuntudebian