Skip to content

常见报错

xsf edited this page Dec 19, 2017 · 1 revision

运行npm run server,出现:

React-SPA/node_modules/koa2-cors/dist/index.js:26
return async function (ctx, next) {
^^^^^^^^
SyntaxError: Unexpected token function
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/Users/allan/Desktop/allan/React-SPA/scripts/server.js:6:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-app@0.1.0 server: `node scripts/server.js`
npm ERR! Exit status 1
npm ERR! 

这是因为node版本过低的缘故,需要重新安装或升级node.js

Clone this wiki locally