具体报错console
c:\Users\Administrator\WebstormProjects\blogtest\node_modules\connect-mongo\src\index.js:4
const Promise = require('bluebird');
^^^^^
SyntaxError: Use of const in strict mode.
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> (c:\Users\Administrator\WebstormProjects\blogtest\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> (c:\Users\Administrator\WebstormProjects\blogtest\app.js:14:18)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
Process finished with exit code 8
使用了const、let、"use strict",解决方法:
把connect-mongo版本降低一点,别用最新版,删除node_modules文件夹,
package.json中把connect-mongo这一条删了,换成"connect-mongo": "0.4.1"(用低版本的)
最后:
npm install