2017-10-06 46 views
0

嗨,我試圖導入我的工人階級和獲得以下錯誤KUE - 意外的令牌進口

(function (exports, require, module, __filename, __dirname) { import { Myclass } from '../utility/myclass'; 
                   ^^^^^^ 
SyntaxError: Unexpected token import 
    at createScript (vm.js:53:10) 
    at Object.runInThisContext (vm.js:95:10) 
    at Module._compile (module.js:543:28) 
    at Object.Module._extensions..js (module.js:580:10) 
    at Module.load (module.js:488:32) 
    at tryModuleLoad (module.js:447:12) 
    at Function.Module._load (module.js:439:3) 
    at Module.runMain (module.js:605:10) 
    at run (bootstrap_node.js:427:7) 

我也得到錯誤在以下

async function getOrder() : Promise<any> { 
         ^
SyntaxError: Unexpected token : 

我用的打字稿,並已列入類型kue的文件。我從命令行運行worker,並且它看起來像能夠理解env ...不知道什麼是錯的。

回答

0

看起來你運行的代碼沒有ES6支持。

您需要使用babel-cli才能運行此代碼,它會在運行代碼之前將代碼編譯爲ES6。

babel-node yourscript.js