node0.12解析let [, abc]失败 请问用koa es6的朋友们怎么处理这些问题?
发布于 9 年前 作者 coderq 7823 次浏览 最后一次编辑是 8 年前 来自 问答

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

求解决方案,谢谢

2 回复

node --harmony --use_strict

@joesonw "C:\Program Files (x86)\JetBrains\WebStorm 10.0.2\bin\runnerw.exe" F:\nodejs\node.exe --harmony --use_strict app.js f:\nodejs\example\sso\app.js:16 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 Function.Module.runMain (module.js:501:10) at startup (node.js:129:16) at node.js:814:3

Process finished with exit code 1

还是不行

回到顶部