DeprecationWarning: grpc.load, Use the @grpc/proto-loader instead

Mah*_*poo 8 node.js firebase google-cloud-firestore

I'm using node with google firebase and always I

(node:13556) DeprecationWarning: grpc.load: Use the @grpc/proto-loader module with grpc.loadPackageDefinition instead

my node version is a latest

$ node -v
v10.14.1
Run Code Online (Sandbox Code Playgroud)

小智 6

npm install --save grpc

npm install --save @grpc/proto-loader

// replace - const notesProto = grpc.load('notes.proto');
// to

const grpc = require('grpc')
const protoLoader = require('@grpc/proto-loader')
const packageDefinition = protoLoader.loadSync('notes.proto');
const notesProto = grpc.loadPackageDefinition(packageDefinition);
Run Code Online (Sandbox Code Playgroud)


Jak*_*eam 4

根据这个GitHub 问题,看起来回滚到 V5.3.0 是一个临时解决方案,或者您可以尝试更新到 Node.js 11.2.0。

  • 即使在 Node.js `v11.10.0` 上仍然看到同样的错误 (2认同)