angular - Angular CLI 7 新项目因 CircularJSON 而失败
问题描述
刚刚将 Angular CLI 重新安装到版本 7.1.1。运行ng new project-name
时出现如下错误:
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance only, flatted is its successor.
npm ERR! code ERR_STREAM_WRITE_AFTER_END
npm ERR! write after end
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\[username]\AppData\Roaming\npm-cache\_logs\2018-12-04T20_40_23_399Z-debug.log
Package install failed, see above.
切换到项目目录时,无法提供新的 Angular 应用程序。如何修复?
解决方案
您应该查看错误详细信息。
npm WARN deprecated circular-json@0.5.9: CircularJSON is in maintenance
only, flatted is its successor.
根据它,Circular-json@0.5.9 已被弃用。你应该使用flatted。一个超轻 (0.5K) 和快速的循环 JSON 解析器,直接来自 CircularJSON 的创建者。CircularJSON 的未来被称为扁平化。
更小、更快并且平均也能够产生更少的输出,扁平化的是新的、无膨胀、ESM 和 CJS 兼容的循环 JSON 解析器。
使用以下方式安装它:npm i flatted