我试图启动服务器,但我收到此错误
/home/ceddy/syd/sydjs/node_modules/keystone/admin/server/middleware/logError.js:7 var msg = `[${endpoint}]`; ^ SyntaxError: Unexpected token ILLEGAL at exports.runInThisContext (vm.js:73:16) at Module._compile (module.js:443:25) at Module._extensions..js (module.js:478:10) at Object.require.extensions.(anonymous function) [as .js] (/home/ceddy/syd/sydjs/node_modules/babel-register/lib/node.js:138:7) 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.createDynamicRouter (/home/ceddy/syd/sydjs/node_modules/keystone/admin/server/app/createDynamicRouter.js:65:21) at createApp (/home/ceddy/syd/sydjs/node_modules/keystone/server/createApp.js:63:72) at [object Object].initExpressApp (/home/ceddy/syd/sydjs/node_modules/keystone/lib/core/initExpressApp.js:5:46) at [object Object].start (/home/ceddy/syd/sydjs/node_modules/keystone/lib/core/start.js:47:7) at Object.(/home/ceddy/syd/sydjs/keystone.js:94:10) 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 Function.Module.runMain (module.js:501:10) at startup (node.js:129:16) at node.js:814:3
当我看到第7行似乎导致错误的文件时,我没有看到任何错误,比如控制台说...我在这里遗漏了什么,请问是什么原因?提前致谢
module.exports = function (req, res, next) { res.logError = function logError(endpoint, description, err) { if (arguments.length === 2 && typeof description !== 'string') { err = description; description = null; } var msg = `[${endpoint}]`; msg += description ? (` ${description}:`) : ' error:'; if (err) { console.log(msg, err.message, '\n' + err.stack); } else { console.log(msg); } }; next(); };
Vlad Miller.. 5
您尝试使用的语法是新ES2015标准的一部分.确保使用支持模板字符串的节点版本
我建议至少节点4.2.3因为它是LTS版本而没有iojs因为它合并回节点.
您尝试使用的语法是新ES2015标准的一部分.确保使用支持模板字符串的节点版本
我建议至少节点4.2.3因为它是LTS版本而没有iojs因为它合并回节点.