Sar*_*roj 6 node.js node-modules
我是Node.js的新手,刚开始使用Eclipse和Nodeclipse插件构建应用程序.当我使用Node 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)
Run Code Online (Sandbox Code Playgroud)
我无法弄清楚这里有什么问题.我搜索了解决方案并发现了一些资源意外的保留字,但我不明白如何将它合并到Eclipse中.
我的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"
}
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将受到高度赞赏.
该class声明是一个 ES6 特性。节点 4.4.6几乎不支持ES6 功能。尝试更新并npm install再次运行
另请参阅https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class
| 归档时间: |
|
| 查看次数: |
6258 次 |
| 最近记录: |