2

I'm using Angular 14. I have the following dependencies in my package.json

"@angular/core": "^14.0.0",
...
"angular-oauth2-oidc": "^14.0.0",

When I start my app, using "ng serve", I get these errors ...

./node_modules/angular-oauth2-oidc/fesm2015/angular-oauth2-oidc.mjs:3611:9-33 - Error: export 'makeEnvironmentProviders' (imported as 'makeEnvironmentProviders') was not found in '@angular/core' (possible exports: ANALYZE_FOR_ENTRY_COMPONENTS, ANIMATION_MODULE_TYPE, APP_BOOTSTRAP_LISTENER, APP_ID, APP_INITIALIZER, ApplicationInitStatus, ApplicationModule, ApplicationRef, Attribute, COMPILER_OPTIONS, CUSTOM_ELEMENTS_SCHEMA, ChangeDetectionStrategy, ChangeDetectorRef, Compiler, CompilerFactory, Component, ComponentFactory, ComponentFactoryResolver ...

Error: node_modules/angular-oauth2-oidc/provider.d.ts:1:10 - error TS2305: Module '"@angular/core"' has no exported member 'EnvironmentProviders'.

1 import { EnvironmentProviders } from '@angular/core';

I'm not quite sure how to troubleshoot this issue, so maybe a good start might be to ask what version of angular-core 14 plays nicely with angular-oauth2-oidc?

Dave
  • 15,639
  • 133
  • 442
  • 830

2 Answers2

0

As mentioned in the readme of the project, versioning matches angular version, so angular-oauth2-oidc : ^14 should work with angular: ^14. Here is a demo where it works https://angular-xejuat.stackblitz.io

Your import issue could be caused by invalid installation, or some other corrupted node_modules state. Try deleting the node_modules (and optionally package-lock.json as well) and installing dependencies again.

yntelectual
  • 3,028
  • 18
  • 24
  • I tried deleting both package-lock.json and node_modules and re-installing with "npm i --legacy-peer-deps". I get the same error. – Dave Apr 18 '23 at 18:29
  • can you start from the provided stackblitz example and add your other dependencies one by one? Verify that your `devDependencies` are in sync with your main deps, double check angular/cli version and that the Angular version is really what it should be in `node_modules/@angular/core/package.json` – yntelectual Apr 21 '23 at 11:56
0

This is a bug on version "angular-oauth2-oidc": "^14.0.0"

It has been fixed on version "angular-oauth2-oidc": "^14.0.1"

FolabiAhn
  • 376
  • 1
  • 11