CNode

node0.12解析let [, abc]失败 请问用koa es6的朋友们怎么处理这些问题?

问答
Ccoderq发布于11 年前最后回复11 年前2 回复8328 浏览0 收藏

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. (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. (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. (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)

C
coderq#1·11 年前
引用 joesonwnode 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

还是不行

J
joesonw#2·11 年前

node --harmony --use_strict

参与回复
登录后即可参与回复。登录