2016-08-24 132 views
0

我完成了,当我试图与后续的命令来访问它解析即成NPM安装如下解析,服务器NPM安装 - 内部服务器错误

$ npm install -g parse-server mongodb-runner 
$ mongodb-runner start 
$ parse-server --appId APPLICATION_ID --masterKey MASTER_KEY 

.....

$ curl -X POST -H "X-Parse-Application-Id: AppID123" -H "Content-Type: application/json" -d '{"score":1337,"playerName":"Sean Plott","cheatMode":false}' http://localhost:1337/parse/classes/GameScore 

我得到了以下错误:

{"code":1,"message":"Internal server error."} 

以下是运行解析服务器的结果....

$ parse-server --appId AppID123 --masterKey Master123 

appId: AppID8Rasp 
masterKey: ***REDACTED*** 
port: 1337 
mountPath: /parse 
maxUploadSize: 20mb 
serverURL: http://localhost:1337/parse 

parse-server running on http://localhost:1337/parse 
warn: Unable to ensure uniqueness for usernames: MongoError: failed to connect to server [localhost:27017] on first connect 
    at null.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:311:35) 
    at emitOne (events.js:77:13) 
    at emit (events.js:169:7) 
    at null.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:254:12) 
    at g (events.js:260:16) 
    at emitTwo (events.js:87:13) 
    at emit (events.js:172:7) 
    at Socket.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:158:49) 
    at Socket.g (events.js:260:16) 
    at emitOne (events.js:77:13) 
warn: Unable to ensure uniqueness for user email addresses: MongoError: failed to connect to server [localhost:27017] on first connect 
    at null.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:311:35) 
    at emitOne (events.js:77:13) 
    at emit (events.js:169:7) 
    at null.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:254:12) 
    at g (events.js:260:16) 
    at emitTwo (events.js:87:13) 
    at emit (events.js:172:7) 
    at Socket.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:158:49) 
    at Socket.g (events.js:260:16) 
    at emitOne (events.js:77:13) 
error: Error generating response. { [MongoError: failed to connect to server [localhost:27017] on first connect] 
    name: 'MongoError', 
    message: 'failed to connect to server [localhost:27017] on first connect' } name=MongoError, message=failed to connect to server [localhost:27017] on first connect 
error: Uncaught internal server error. { [MongoError: failed to connect to server [localhost:27017] on first connect] 
    name: 'MongoError', 
    message: 'failed to connect to server [localhost:27017] on first connect' } MongoError: failed to connect to server [localhost:27017] on first connect 
    at null.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:311:35) 
    at emitOne (events.js:77:13) 
    at emit (events.js:169:7) 
    at null.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:254:12) 
    at g (events.js:260:16) 
    at emitTwo (events.js:87:13) 
    at emit (events.js:172:7) 
    at Socket.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:158:49) 
    at Socket.g (events.js:260:16) 
    at emitOne (events.js:77:13) 
MongoError: failed to connect to server [localhost:27017] on first connect 
    at null.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:311:35) 
    at emitOne (events.js:77:13) 
    at emit (events.js:169:7) 
    at null.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:254:12) 
    at g (events.js:260:16) 
    at emitTwo (events.js:87:13) 
    at emit (events.js:172:7) 
    at Socket.<anonymous> (/usr/local/lib/node_modules/parse-server/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:158:49) 
    at Socket.g (events.js:260:16) 
    at emitOne (events.js:77:13) 

当然可以使用一些指针!谢谢。

+0

的错误说,它不能连接到数据库,因此验证数据库正在运行。 –

+0

我很抱歉这么厚,但我该怎么做? – hypermiler

+0

试过; sudo服务分析服务器状态。说它没有运行。如果它没有运行,那么jeeez,怎么了? parse-server命令似乎正在工作..... – hypermiler

回答