为什么我得到这个错误,当我运行server.js时,massive.connectSync不是一个函数。它可以在我的mac上运行,但不能在我的windows上运行。请帮助解决此enter code here
错误
var express = require("express");
var app = express();
var http = require('http');
var massive = require("massive");
var connectionString = "postgres://massive:@localhost/MarketSpace";
// connect to Massive and get the db instance. You can safely use the
// convenience sync method here because its on app load
// you can also use loadSync - it's an alias
var massiveInstance = massive.connectSync({connectionString : connectionString})
// Set a reference to the massive instance on Express' app:
app.set('db', massiveInstance);
http.createServer(app).listen(8080);
发布于 2017-08-18 10:34:04
不再支持同步函数,connect函数本身也不再存在,它一直都是有希望的:
var express = require("express");
var app = express();
var http = require('http');
var massive = require("massive");
var connectionString = "postgres://massive:@localhost/MarketSpace";
massive(connectionString).then(massiveInstance => {
app.set('db', massiveInstance);
http.createServer(app).listen(8080);
});
请注意,massive需要大于6的节点。如果您使用的是更老的版本,则需要更新节点才能使用massive。
https://stackoverflow.com/questions/45747517
复制相似问题