MDB-Angular Admin Dashboard 5.0.0 – not building


Topic: MDB-Angular Admin Dashboard 5.0.0 – not building

Rostislav pro asked 4 years ago

I have got an error duaring "ng build" MDB Angular Dashboard 5.0.0

ERROR in node_modules/@agm/core/services/maps-api-loader/lazy-maps-api-loader.d.ts(1,10): error TS2305: Module '"D:/tmp
ng-admin-pro/node_modules/@angular/core/core"' has no exported member 'OpaqueToken'.

Also i have notice that root package.json has reference @angular to 5.x although package.json in  src/app/typescripts/pro has dependency to @angular 4.3. I also supposed that it has version of mdb is 4.x but not 5

Please correct this package


Damian Gemza staff answered 4 years ago

Hi Benny Bottema, I've checked your's solution and it's works perfectly. I'm closing this topic. Best Regards, Damian

Benny Bottema pro answered 4 years ago

I ran into the same issue for 5.0.5 and I updated the agm dependency in package.json to 1.0.0-beta.2.

So:
"dependencies": {
   "@agm/core": "1.0.0-beta.2",
   ...
}

This solved it for me. Althought running "npm i" again didn't work for me for some unknown reason (had to remove node_modules completely first).


Sebastian Kaczmarek staff answered 4 years ago

Hi Rostislav, Since AGM module is a third-party dependency we have no influence on its Angular support. The error you have is caused by a difference in Angular version (AGM- v4.x while MDB- v5.x). The quick workaround for this is to replace all the occurrences of OpaqueToken to InjectionToken<any> in the localization specified in the error message. node_modules/@agm/core/services/maps-api-loader/lazy-maps-api-loader.d.ts:
export declare const LAZY_MAPS_API_CONFIG: InjectionToken; // Instead of OpaqueToken
  and   node_modules/@agm/core/services/maps-api-loader/lazy-maps-api-loader.js:
export var LAZY_MAPS_API_CONFIG = new InjectionToken('angular-google-maps LAZY_MAPS_API_CONFIG'); // Instead of OpaqueToken
  According to your second issue, thanks for noticing. It's just our oversight in versioning. We will fix that. Best regards, Sebastian

Benny Bottema pro commented 4 years ago

This is happening to 5.0.5 as well.

Benny Bottema pro commented 4 years ago

Actually it's very bad to edit node modules as a work around. > Since AGM module is a third-party dependency we have no influence on its Angular support. I'm sorry, but what? You develop this library against specific versions of dependencies (in this case agm@1.0.0-beta.0), so it either works or it doesn't when you release it. The only way it can break *after* you released this is if AGM unpublished their version in NPM and replaced it with a different one. Unless you meant something else, then I have no idea.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Closed

Specification of the issue
  • User: Pro
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags