无法在“历史记录”上执行“ replaceState”:Angular中的“ ng build”时带有URL的历史记录状态对象 [英] Failed to execute 'replaceState' on 'History': A history state object with URL While `ng build` in Angular
本文介绍了无法在“历史记录”上执行“ replaceState”:Angular中的“ ng build”时带有URL的历史记录状态对象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在angular项目中运行 ng build --prod
或 ng build
时,出现此错误
While Running ng build --prod
or ng build
in angular project i got this error
任何想法如何解决?
PS:我已经将angular-cli的版本从 1.2.6
> 1.2.3 ,仍然无法正常工作。
PS: I have already changed the version of angular-cli to 1.2.6
from 1.2.3
, still not working.
在谷歌搜索后,我发现这是Chrome浏览器的安全性问题,但是我该如何解决
After googling i found this is issue of security with chrome browser, but how to solve this i am unable to figure out.
推荐答案
- cd project-dir
- 删除node_modules和package-lock.json
- npm卸载@ angular / cli -g
- npm缓存清理--force
- npm install @ angular / cli -g
- npm缓存验证
- 关闭控制台并打开新的控制台会话
- cd项目目录
- npm install
- ng --version(结果:1.4.2)
- ng build --prod
- cd project-dir
- delete node_modules and package-lock.json
- npm uninstall @angular/cli -g
- npm cache clean --force
- npm install @angular/cli -g
- npm cache verify
- close console and open new console session
- cd project-dir
- npm install
- ng --version (result : 1.4.2)
- ng build --prod
它成功运行
这篇关于无法在“历史记录”上执行“ replaceState”:Angular中的“ ng build”时带有URL的历史记录状态对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文