无法在“历史记录”上执行“ replaceState”:Angular中的“ ng build”时带有URL的历史记录状态对象 [英] Failed to execute 'replaceState' on 'History': A history state object with URL While `ng build` in Angular

查看:85
本文介绍了无法在“历史记录”上执行“ 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.

推荐答案


  1. cd project-dir

  2. 删除node_modules和package-lock.json

  3. npm卸载@ angular / cli -g

  4. npm缓存清理--force

  5. npm install @ angular / cli -g

  6. npm缓存验证

  7. 关闭控制台并打开新的控制台会话

  8. cd项目目录

  9. npm install

  10. ng --version(结果:1.4.2)

  11. ng build --prod

  1. cd project-dir
  2. delete node_modules and package-lock.json
  3. npm uninstall @angular/cli -g
  4. npm cache clean --force
  5. npm install @angular/cli -g
  6. npm cache verify
  7. close console and open new console session
  8. cd project-dir
  9. npm install
  10. ng --version (result : 1.4.2)
  11. ng build --prod

它成功运行

这篇关于无法在“历史记录”上执行“ replaceState”:Angular中的“ ng build”时带有URL的历史记录状态对象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆