更新npm后,出现此错误。
TypeError: Cannot read property 'message' of undefined .
at new MongoError (testuser/node_modules/mongodb-core/lib/error.js:22:23)
at new MongoNetworkError (testuser//node_modules/mongodb-core/lib/error.js:60:5) .
at TLSSocket.err (testuser//node_modules/mongodb-core/lib/connection/connect.js:287:16) .
at Object.onceWrapper (events.js:277:13) .
at TLSSocket.emit (events.js:189:13)
at TLSSocket.Socket._onTimeout (net.js:440:8) .
at ontimeout (timers.js:436:11) .
at tryOnTimeout (timers.js:300:5) .
at listOnTimeout (timers.js:263:5) .
at Timer.processTimers (timers.js:223:10) .
在连接MongoDB时: 以下是mongo connect代码:
mongoose.connect(Mongo.MONGO_URL, {
user: Mongo.MONGO_USER,
pass: Mongo.MONGO_PASSWORD,
useNewUrlParser: true,
useCreateIndex: true,
socketTimeoutMS: 0,
keepAlive: true,
reconnectTries: 30
});