我有一个 angular 项目,最近我使用以下命令向它添加了 angular-universal:
ng add @nguniversal/express-engine --clientProject {{ name of your project }}
Run Code Online (Sandbox Code Playgroud)
构建和运行它:
npm run build:ssr && npm run serve:ssr
Run Code Online (Sandbox Code Playgroud)
这样做后我遇到了很多错误,但我设法让它正常工作,但是当我访问我的主页时,它将以下内容写入控制台:
(node:44714) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
ERROR [Error]
ERROR [Error]
Run Code Online (Sandbox Code Playgroud)
每次我刷新页面时,它都会在ERROR [Error]没有任何细节的情况下再次打印,请注意new Buffer()我的代码中没有任何内容,并且我已经按照堆栈溢出的建议解决了这个问题,但没有运气,有人可以帮助弄清楚是什么吗造成这个?
我已经ERROR [Error]通过删除 TranslateService解决了这个问题,但仍然有 deprecationWarning