在Node 4.3中使用Buffer.from时,TypeError Base64不是函数

我在节点4.3上使用标准的Amazon Machine Image(linux x64)在本地debugginglambda函数,

当我运行这个程序的时候,我得到一个函数的错误,这个函数是为了将一个base64string解码为utf-8。 错误说

Unhandled rejection TypeError: base64 is not a function at Function.from (native) at Function.from (native) at /home/ec2-user/sass-compiler/lib/compiler.module.js:26:30 

我的代码看起来很简单。 我已经检查过,所以节点4.3文档和我的代码似乎符合。 任何想法我可能做错了什么?

 template() { return new Promise((resolve, reject) => { let buf = Buffer.from(this._opts.tpl, 'base64').toString('utf-8'); let _tpl = _.template(buf); resolve(_tpl(this._opts.opts)); }); } 

编辑该程序工作得很好,在Windows 10使用节点LTS 6.9.5

我终于find堆栈溢出回答这个问题的答案。

NodeJS:如何解码base64编码的string回二进制?

在节点5.3&以下,您需要使用缓冲区构造函数(即: new Buffer )而不是Buffer.from