无法在“历史记录”上执行“replaceState”:带有URL的历史状态对象在Angular中使用“ng build”

时间:2017-08-28 07:39:45

标签: angular build

在角项目中运行@NgModule ({ declarations: [ SharedMoudule, ReportsComponent ], }); export class ReportsModule {} ng build --prod时出现此错误

enter image description here

任何想法如何解决这个问题?

PS:我已经将{cline-cli的版本从ng build更改为1.2.6,但仍无效。

谷歌搜索后发现这是Chrome浏览器的安全问题,但如何解决这个问题我无法弄明白。

1 个答案:

答案 0 :(得分:1)

  1. cd project-dir
  2. 删除node_modules和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. 关闭控制台并打开新的控制台会话
  8. cd project-dir
  9. npm install
  10. ng --version(结果:1.4.2)
  11. ng build --prod
  12. 它成功运作

相关问题