DeprecationWarning: Buffer// 由于安全和易用性的问题,它已经过时了。 请使用方法 Buffer.alloc//, ...

我有一个项目 angular, 我最近添加到他身边 angular-universal 使用以下命令:


ng add @nguniversal/express-engine --clientProject {{ name of your project }}


他们的建设和管理:


npm run build:ssr && npm run serve:ssr


之后,我有很多错误,但我设法使它工作,但是当我访问我的主页时,他在控制台中写下以下内容:


/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]


每次更新页面时,它都会再次打印
ERROR [Error]

没有任何细节,请注意,我没有
new Buffer//

在我的代码中,我遵循了建议 stack overflow, 要解决这个问题,但不是幸运的,任何人都可以帮助了解它的原因是什么吗?

我解决了这个问题
ERROR [Error]

, 鸭子 TranslateService, 但仍然拥有 deprecationWarning
已邀请:

三叔

赞同来自:

如果您正在使用
Buffer//

在其代码中,只需替换它:


new Buffer/number/ // Deprecated 
Buffer.alloc/number/ // New


或者


new Buffer/string/ // Deprecated 
Buffer.from/string/ // New


如果你无处可去

不是

使用
Buffer//

, 您需要执行以下操作:

1/ 查找应用程序的所有依赖项。 /您可以通过单击“搜索”图标使用搜索工具 IDE, 您现在使用哪些使用并输入
Buffer//

/

2/ 无论你找到哪里
Buffer//

在模块或依赖项中,只需更换如上所述

江南孤鹜

赞同来自:

我得到了同样的警告,它似乎根本不会影响任何东西。
我做了一个替代品 find &, 但猜测在我的代码中 /源代码中没有,也没有编译 bundle/ 没有什么可以对应的 Buffer//, 因此,我很好奇。
我有最新版本 node LTS /12.14.1/, 但我更新了 npm 到 6.13.6
此外,如果在我的生产服务器或开发服务器上部署,我必须说客户版本不产生此结论,这才会在维护版本时发生这种结论 SSR 穿过 iisnode, 我不知道它是否有帮助。

要回复问题请先登录注册