I deployed my Angular
website to the Firebase
and I get the error
"Uncaught ReferenceError: ngI18nClosureMode is not defined"
this is my website in the Firebase https://shopping-demo-cd112.firebaseapp.com/ Any friends get this error like this ? Thank you for your help!
I had the same issue in my project after updated it from angular 7 to angular 8.2.1. The problem here is the CLI is not updated, because I updated the angular/core packages alone.
Please update your angular-cli to 8.2.1 and build the production version again then your build will run without any issues.
Try downgrading your Angular version to "~8.0.0". There is a currently an open issue linked to missing variables inside the bundle built by Angular in production mode.
You might also want to post the details about your setup to the issue bellow: https://github.com/angular/angular/issues/31595
Other workarounds consists of injecting the missing variables into the bundle, which in your case might not be necessary, if you can downgrade to Angular 8.0.0
In my case, the error appeared when running ng build --prod
, and then deploying in firebase using firebase deploy --only hosting:project-name -m "some message"
My development environment runs on the MacOS catalina V 10.15.2 terminal
I pointed the reason to be inconsistencies between the versions of the ng-packages within the local project folder and the versions installed globally in the system, as it is explained bellow.
If I did ng --version
While on root, the response was:
Angular CLI: 8.3.21
Node: 10.14.1
OS: darwin x64
Angular:
...
Package Version
------------------------------------------------------
@angular-devkit/architect 0.803.21
@angular-devkit/core 8.3.21
@angular-devkit/schematics 8.3.21
@schematics/angular 8.3.21
@schematics/update 0.803.21
rxjs 6.4.0
But the response to the same command while in the project folder was:
Angular CLI: 7.1.4
Node: 10.14.1
OS: darwin x64
Angular: 8.2.14
...
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.11.4
@angular-devkit/core 7.1.4
@angular-devkit/schematics 7.1.4
@schematics/angular 7.1.4
@schematics/update 0.11.4
rxjs 6.5.4
Please note how the @angular CLI version and packages are different.
How did I solved this?
While on the project folder:
npm install --save-dev @angular/cli@latest
npm install
After that, your project packages will be updated.
Then I ran the production build:
ng build --prod
, and finally deployed to firebase hosting the compiled content of my public folder using firebase deploy --only hosting:project-name -m "some message"
and the error was gone.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With