Ionic context.getProjectMetadata is not a function [Live Reload only]

Viewed 1944

I'm facing an issue with ionic live reload failing to build due to the error "context.getProjectMetaData is not a function" I am just encountering this issue after installing the Firebase cloud messaging cordova plugin and npm package (for push notifications). Im unsure if this would the issue as the app build and launches without live reload. (and fcm works properly)

This is the error log im getting, anyone experienced this before?

[error] TypeError: context.getProjectMetadata is not a function
    at Object.configureI18nBuild (..\node_modules\@angular-devkit\build-angular\src\utils\i18n-options.js:99:36)
    at Object.generateI18nBrowserWebpackConfigFromContext (..\node_modules\@angular-devkit\build-angular\src\utils\webpack-browser-config.js:85:57)
    at Object.buildBrowserWebpackConfigFromContext (..\node_modules\@angular-devkit\build-angular\src\browser\index.js:67:41)
    at setup ..\node_modules\@angular-devkit\build-angular\src\dev-server\index.js:103:63)


3 Answers

I started having this problem after I ran npm audit fix because I wanted to have a project that's clean of vulnerabilities.

It seems, npm audit fix command is rather greedy. It silently upgraded my "@angular-devkit/build-angular": "~0.803.25" to version 0.9, thus breaking my Angular 8 app with the same context.getProjectMetadata is not a function error.

Morale of the story - be very careful with npm audit fix and inspect what it does to your package.json.

Make sure that these two packages have the same version and that the version compatible with your angular version.

    "@angular-devkit/architect": "^0.1001.4",
    "@angular-devkit/build-angular": "^0.1001.4",
Related