PhantomJS:"SyntaxError:意外的令牌=>" [英] PhantomJS: "SyntaxError: Unexpected token =>"

查看:76
本文介绍了PhantomJS:"SyntaxError:意外的令牌=>"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前在使用phantomJS时遇到问题.有什么建议吗?

Im currently having problems using phantomJS. Any suggestions?

acanyon$ babel-node source_parser.js http://url

/Users/.../node/node_modules/phantom/lib/index.js:23
  return new Promise(resolve => resolve(new _phantom2.default(args, config)));
                             ^^
SyntaxError: Unexpected token =>
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Module._extensions..js (module.js:478:10)
    at Object.require.extensions.(anonymous function) [as .js] (/Users/acanyon/.nvm/versions/node/v0.12.4/lib/node_modules/babel-cli/node_modules/babel-register/lib/node.js:152:7)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/acanyon/fashionblog/node/source_parser.js:4:15)
    at Module._compile (module.js:460:26)

我是否缺少es6的垫片? (脚本的其余部分用es5编写).

Am I missing a shim for es6? (the remainder of the script is written in es5).

推荐答案

Phantomjs使用ES5,而不是ES6;)

Phantomjs use ES5, not ES6 ;)

这就是为什么它不能按预期工作的原因

That's why it doesn't work as expected

这篇关于PhantomJS:"SyntaxError:意外的令牌=&gt;"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆