How to fix Angular6 "_getAriaLabel is not a function" with production build
Problem:
You are building an Angular6 application and in development mode everything works fine. However, if you build in production mode:
build_prod.sh
ng build --prod --aotyou see an error like this in the client:
example.txt
main.4d1baabffbba5677af03.js:1 ERROR TypeError: i.ɵnov(...)._getAriaLabel is not a function
at Object.updateRenderer (main.4d1baabffbba5677af03.js:1)
at Object.updateRenderer (main.4d1baabffbba5677af03.js:1)
[...]Solution
The issue appears to be caused by incorrectly updated NodeJS modules. You can fix it by simply deleting your node_modules folder:
example.sh
rm -rf node_modulesFurthermore, it’s recommended to update @angular/cli as the bug does not seem to be present in newer versions of @angular/cli:
example.sh
sudo npm i -g @angular/cliCheck out similar posts by category:
Angular, Javascript
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow