dha*_*hmi 6 module protocol-buffers node.js npm
我正在尝试使用 Protocol Buffers - Google 的数据交换格式,参考https://github.com/google/protobuf/tree/master/js
我尝试按照文档进行操作,我能够设置协议编译器并能够执行以下操作
protoc --js_out=library=myproto_libs,binary:. messages.proto
Run Code Online (Sandbox Code Playgroud)
但是当我 npm install google-protobuf 我得到
npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/google-
npm ERR! 404
npm ERR! 404 'google-protobuf' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
Run Code Online (Sandbox Code Playgroud)
如果我编写可以使用生成的二进制文件的示例,则表示 goog 未定义
goog.require('com.nec.eva.msap.proto.alerts.FaceAlert');
var message = com.nec.eva.msap.proto.alerts.FaceAlert();
message.watchlist_id("1");
message.candidate_id("25");
message.gender("female");
bytes = message.serializeBinary();
Run Code Online (Sandbox Code Playgroud)
我不知道为什么我无法进行 npm install 以及 goog.require('com.nec.eva.msap.proto.alerts.FaceAlert'); 是如何进行的 将使用生成的二进制文件请帮助我几乎花了一天时间来理解但没有得到它
| 归档时间: |
|
| 查看次数: |
6924 次 |
| 最近记录: |