继我之前的问题之后,我正在尝试在 node.js 中使用协议缓冲区。我ServiceMessage_pb.js
从我的 生成ServiceMessage.proto
,并添加以下代码:
var messages = require('./ServiceMessage_pb');
现在我的节点日志中出现以下错误:
Error: Cannot find module 'google-protobuf'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/aii/ws/ServiceMessage_pb.js:8:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
任何建议如何解决这个问题?
谢谢