Uncaught TypeError: useValue, useFactory, data is not repeated! Angular project error 4 cli

I'm new to Angular 4, I just created an Angular Cli project, and I am getting an error like

Uncaught TypeError: useValue,useFactory,data is not iterable! 

enter image description here

I can’t solve it. I installed and reinstall cli, I just want to know how I can solve it. All I did was

 ng new myprj mkdir myprj ng serve 
+5
source share
3 answers

I fixed the problem by adding es6-shim to the script tag in my index.html file:

<script> src = "https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.22.1/es6-shim.min.js"> </ s cript>

I encountered the same problem when running ng test during my deployment in Travis, although it ran without errors locally.

 Chromium 37.0.2062 (Ubuntu 0.0.0) ERROR Uncaught TypeError: useValue,useFactory,data is not iterable! at http://localhost:9876/_karma_webpack_/polyfills.bundle.js:830 
+2
source

This error usually occurs if the browser does not have new features. Can be easily fixed by including polyfills.

 import 'core-js/es6/symbol'; import 'core-js/es6/object'; import 'core-js/es6/function'; import 'core-js/es6/parse-int'; import 'core-js/es6/parse-float'; import 'core-js/es6/number'; import 'core-js/es6/math'; import 'core-js/es6/string'; import 'core-js/es6/date'; import 'core-js/es6/array'; import 'core-js/es6/regexp'; import 'core-js/es6/map'; import 'core-js/es6/weak-map'; import 'core-js/es6/set'; 

To your vendor’s file or a file that will start your tests if you switched to karma.config.js

  browsers: ['Chrome'] to browsers: ['PhantomJS'] 

Or get this error after running ng test

+2
source

If your problem is the same as mine, you need to go to the polyfills.ts file in your project to ensure backward compatibility.

There are several lines for unlocking and packages for installation, indicated in the comments. Some of them are required to run the application in any version of IE.

Helped me.

+1
source

Source: https://habr.com/ru/post/1270191/


All Articles