“gulp-babel”在 node js 版本 4 中不起作用

洛加克里希南

gulp-babel我的 gulp 文件中需要es6在我的 js 文件中使用语法时,出现错误

/home/logakrishnan/Documents/project/node_modules/@babel/core/lib/transformation/file/file.js:77
  constructor(options, {
                       ^

SyntaxError: Unexpected token {
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    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)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/logakrishnan/Documents/project/node_modules/@babel/core/lib/index.js:153:36)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

节点版本: v4.4.7

AKX

你必须升级你的 Node.js 版本。(Node 4 来自 2016 年,在 JavaScript 术语中是相对永恒的。)

在撰写本文时,Babel 需要 Node 6.9 或更新版本。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章