错误代码门户
Node.jsNode.js错误代码

ERR_BUFFER_CONTEXT_NOT_AVAILABLE

buffer context not available

代码 ERR_BUFFER_CONTEXT_NOT_AVAILABLE · Node.js 报告的问题。

尝试在与 Node.js 实例不关联的 JS 引擎上下文中从插件或嵌入器代码创建 Node.js Buffer 实例。传递给 Buffer 方法的数据将在该方法返回时被释放。 遇到此错误时,创建 Buffer 实例的可能替代方法是创建一个普通的 Uint8Array,它仅在结果对象的原型上有所不同。 Uint8Array 普遍被所有 Node.js 核心 API 所接受,其中 Buffer 所在;它们在所有上下文中都可用。

Google Translate · 此内容为自动翻译。技术术语及适用条件请以英文原文为准。

An attempt was made to create a Node.js Buffer instance from addon or embedder code, while in a JS engine Context that is not associated with a Node.js instance. The data passed to the Buffer method will have been released by the time the method returns. When encountering this error, a possible alternative to creating a Buffer instance is to create a normal Uint8Array, which only differs in the prototype of the resulting object. Uint8Arrays are generally accepted in all Node.js core APIs where Buffers are; they are available in all Contexts.

故障排除与诊断链接

请先确认文档中的产品、版本及发生环境与当前情况一致。