The Error “TypeError: iterator.next is not a function”, is an error that is invoked when you are working on angular and are trying to create a new workspace and are trying to use the ng lint command.
Given below is the snippet of the error you might get:
TypeError: iterator.next is not a function
To fix the error and to make sure the error is not repeated again it is important to know the cause of the error and how to fix the error.
Below we will discuss the cause of the error, “TypeError: iterator.next is not a function”:
The error ‘TypeError: iterator.next is not a function’ is seen because there is a flaw in the @nrwl/devkit package, which is a requirement for the @angular-eslint/builder.
Their GitHub repository includes a report about it here as “Running ng lint
causes an error in the devkit package of nx
“.
A patch has recently been released and most likely going to be fixed in the upcoming release, which is version (14.5.9).
There is a fix available for this in the previous version of angular workspace which is version v14.0.0.
This error is usually seen when installing and configuring Angular application in the version 14.1.3 and using “ng add @angular-eslint/schematics” to add eslint; “@nrwl/devkit” in version “14.5.8”
To fix the error, “TypeError: iterator.next is not a function”, you need to know that @nrwl/devkit seems to be the troublesome dependents which is causing the error, so rolling back to the previous version 14.0.0, will help fix the issue.
This error is usually seen when installing and configuring Angular application in the version 14.1.3 and using “ng add @angular-eslint/schematics” to add eslint; “@nrwl/devkit” in version “14.5.8”.
This should help you to fix the issue, “TypeError: iterator.next is not a function”.
Conclusion
To fix the error, “TypeError: iterator.next is not a function”, you need to know that @nrwl/devkit seems to be the troublesome dependent which is causing the error, therefore you will have to revert to version 14.0.0.
Rolling back to the previous version that is version 14.0.0, will help fix the issue which you are facing.