node0.12解析let [, abc]失败 请问用koa es6的朋友们怎么处理这些问题?
发布于 2天前 作者 coderq 107 次浏览 来自 问答

let [, func = C.defaults.func] = this.request.url.split(‘/’); d:\nodejs\code\sso\src\app.js:15 let [, func = C.defaults.func] = this.request.url.split(‘/’); ^ SyntaxError: Unexpected token , at exports.runInThisContext (vm.js:73:16) at Module._compile (module.js:443:25) at Object.Module._extensions…js (module.js:478:10) 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> (d:\nodejs\code\sso\start.js:6:1) at Module._compile (module.js:460:26) at Object.Module._extensions…js (module.js:478:10)

这个es6语法解析错误了,想着用babel转成es5,结果又来这个错 d:\nodejs\code\sso\lib\app.js:18 app.use(regeneratorRuntime.mark(function callee$0$0() { ^ ReferenceError: regeneratorRuntime is not defined at Object.<anonymous> (d:\nodejs\code\sso\lib\app.js:18:9) at Module._compile (module.js:460:26) at Object.Module._extensions…js (module.js:478:10) 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> (d:\nodejs\code\sso\start.js:6:1) at Module._compile (module.js:460:26) at Object.Module._extensions…js (module.js:478:10)

Process finished with exit code 1

求解决方案,谢谢

1 回复

node --harmony --use_strict

回到顶部