它在Windows中运行良好,但在ubuntu中存在问题。 root @ tegra-ubuntu:/ home / ubuntu / pt / nodejs / new#node --harmony app.js
/home/ubuntu/.local/share/Trash/files/new/node_modules/connect-mongo/src/index.js:28
unserialize: options.unserialize || (x => x),
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/ubuntu/.local/share/Trash/files/new/node_modules/connect-mongo/index.js:1:80)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/ubuntu/.local/share/Trash/files/new/app.js:11:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
答案 0 :(得分:0)
我认为你不能在节点.10。*
中使用箭头功能尝试使用ES5
unserialize: options.unserialize || function(x) {return x;}