2017-02-15 22 views
2

我在節點本地4.3調試lambda函數使用標準的Amazon機器映像(Linux的x64)的類型錯誤Base64是不是一個功能節點使用Buffer.from時4.3

當我運行程序時,我得到一個錯誤的函數是爲了將base64字符串解碼爲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 

我的代碼看起來很簡單。我檢查過SO和node 4.3 docs,我的代碼看起來很合規。任何想法我可能做錯了什麼?

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)); 
     }); 
    } 

編輯程序使用節點LTS 6.9.5

回答

相關問題