I had this error in Angular reactive forms, here is how I fixed it.

The error

main.js:1 ERROR TypeError: Cannot read properties of null (reading '_rawValidators')

Solution

After some digging, I realized. it must be about formControlName. Make sure you do not have a type made in it.

this.yourForm = this.fb.group({
    name: [''],
    contact: this.fb.group({
      address: ['']
    }) 
})
<form [formGroup]="yourForm">
  <input type="text" formControlName="name" />
  <div formGroupName="contact">
    <input type="text" formControlName="address" />
  </div>
</form>

 

 

Saved you some valuable time?

Buy me a drink 🍺 to keep me motivated to create free content like this!