如何修复 Angular6 生产构建中的 _getAriaLabel is not a function
问题:
你正在构建 Angular6 应用程序,在开发模式下一切正常。但是,如果你在生产模式下构建:
build_prod.sh
ng build --prod --aot你在客户端看到类似这样的错误:
angular_production_error.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)
[...]解决方案
问题似乎是由不正确更新的 NodeJS 模块引起的。你可以通过简单地删除 node_modules 文件夹来修复它:
remove_node_modules.sh
rm -rf node_modules此外,建议更新 @angular/cli,因为该 bug 似乎在 @angular/cli 的较新版本中不存在:
update_angular_cli.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