我是新手节点刚开始使用
eclipse和nod
eclipse插件的应用程序.当我使用节点core.js运行应用程序时它工作正常,但使用eclipse它显示我跟随错误.
/home/sarojs/projects/Core/security.js:3 class Security { ^^^^^ SyntaxError: Unexpected reserved word 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> (/home/sarojs/projects/node/liveprojects/ecurvInc/Core/core.js:12:16) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10)
无法弄清楚这里有什么问题.我搜索了解决方案,发现了一些资源Unexpected reserved word,但不明白如何融入我的日食
我的package.json看起来像
{ "dependencies": { "bluebird": "^3.4.0","body-parser": "~1.8.1","cookie-parser": "~1.3.3","cors": "^2.8.1","debug": "~2.0.0","express": "~4.9.0","express-handlebars": "^3.0.0","express-session": "^1.13.0","MysqL": "^2.11.1","passport": "^0.3.2","passport-local": "^1.0.0" } }
仅供参考:
我的节点版本是4.4.6
IDE使用nodeclipse插件eclipse Mars 1
任何帮助将受到高度赞赏.
解决方法
类声明是ES6功能. ES6在节点4.4.6中具有
are hardly supported.尝试
updating并再次运行npm install
另见https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class