ReferenceError: StringDecoder is not defined
来源:程序员人生 发布时间:2016-07-15 08:47:44 阅读次数:3332次
1、毛病描写
> var sd=require("string_decoder").StringDecoder;
undefined
> var decoder=new StringDecoder();
ReferenceError: StringDecoder is not defined
at repl:1:17
at REPLServer.defaultEval (repl.js:262:27)
at bound (domain.js:287:14)
at REPLServer.runBound [as eval] (domain.js:300:12)
at REPLServer.<anonymous> (repl.js:431:12)
at emitOne (events.js:82:20)
at REPLServer.emit (events.js:169:7)
at REPLServer.Interface._onLine (readline.js:211:10)
at REPLServer.Interface._line (readline.js:550:8)
at REPLServer.Interface._ttyWrite (readline.js:827:14)
>
2、毛病缘由 由毛病提示可知,StringDecoder没有定义
3、解决办法
> var StringDecoder=require("string_decoder").StringDecoder;
undefined
> var decoder=new StringDecoder();
undefined
生活不易,码农辛苦
如果您觉得本网站对您的学习有所帮助,可以手机扫描二维码进行捐赠