Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

2K
Views
Error de Angular/Ivy: Error: Token InjectionToken XXXXXXXXX no tiene una definición de ɵprov

Obteniendo el error después de actualizar al compilador Angular 9 / Ivy

 ERROR Error: Token InjectionToken XXXXXXXXX is missing a ɵprov definition. at injectableDefOrInjectorDefFactory (vendor.js:47105) at providerToFactory (vendor.js:47210) at resolveProvider$1 (vendor.js:56430)
over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Esto puede ocurrir si intenta anular explícitamente un inyectable heredado con undefined o null .

En Angular 8 esto estaba bien

 { provide: AMBIENT_CART, useExisting: undefined }

Con Angular 9 debe cambiarse a

 { provide: AMBIENT_CART, useValue: undefined }

Si tiene curiosidad: en mi caso, estaba haciendo esto por razones de seguridad, para asegurarme de no usar este inyectable en particular por error.

over 4 years ago · Santiago Trujillo Report

0

Recibí el mismo error al ejecutar la prueba ng después de actualizar desde Angular 8 --> 9: "Error: Token InjectionToken apiToken no tiene una definición de ɵprov".

Mi solución a esto fue muy simple: había un error tipográfico en el archivo de especificaciones que supongo que no importaba en Angular 8, pero ¿en Angular 9? La última instancia de 'useValue' a continuación se escribió incorrectamente como 'usevalue'. ¡Qué error tan oscuro!

 TestBed.configureTestingModule({ imports: [ HttpClientTestingModule ], providers: [ { provide: ApiService, useValue: apiService }, { provide: ProductsApiService, useValue: productsService }, { provide: apiToken, useValue: mockApiToken } ] });
over 4 years ago · Santiago Trujillo Report

0

Empecé a recibir este error mientras ejecutaba pruebas unitarias después de actualizar una aplicación de Angular 8 a Angular 10. El problema se produjo porque el archivo de especificaciones existente usaba value en lugar de useValue en la matriz de proveedores, como se muestra en el siguiente ejemplo. Se solucionó el problema cambiándolo a useValue .

 beforeEach(async(() => { void TestBed.configureTestingModule({ declarations: [ MockPipe(TranslatePipe), ], imports: [ HttpClientTestingModule, ], providers: [ FormBuilder, MessageService, { provide: MESSAGES_TOKEN, value: {} }, //changed to useValue ] }).compileComponents(); }));
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!