1,315   MongoDB RedHat

使用connect-mongo连接MongoDB,启动时报错了

/usr/share/system-config-web/html/NodeJS-learn-forum/node_modules/connect-mongo/src/index.js:28
            unserialize: options.unserialize || (x => x),
                                                    ^
SyntaxError: Unexpected token >
    at Module._compile (module.js:439:25)

后来查了GitHub上的介绍,原来是NodeJS版本和connect-mongo配置不匹配导致的,请看这里:https://github.com/kcbanner/connect-mongo#old-nodejs-versions-compatibility

因为在RedHat5上只能安装NodeJS 0.10的版本,所以connect-mongo配置修改成

var MongoStore = require('connect-mongo/es5')(session);



Leave a Reply

Your email address will not be published. Required fields are marked *