我无法使用命令“sudo systemctl start mongod”启动 mongoDB。
我收到以下消息:
? mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Wed 2020-02-19 22:39:00 CET; 2s ago
Docs: https://docs.mongodb.org/manual
Process: 29368 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=14)
Main PID: 29368 (code=exited, status=14)
Feb 19 22:39:00 pop-os systemd[1]: Started MongoDB Database Server.
Feb 19 22:39:00 pop-os systemd[1]: mongod.service: Main process exited, code=exited, status=14/n/a
Feb 19 22:39:00 pop-os systemd[1]: mongod.service: Failed with result 'exit-code'.
Run Code Online (Sandbox Code Playgroud)
我已经重新安装了 mongodb 并且我遇到了同样的问题。如果你能帮助我,我不知道错误来自哪里。谢谢你。
我使用的是 Strapi.io 开源 Node.js Headless CMS
这是我的注册页面代码
void _registerUser() 异步 {
http.Response response =
await http.post('http://localhost:1337/auth/local/register', body: {
"username": _userName,
"email": _email,
"password": _password,
});
final responseData = json.decode(response.body);
if (response.statusCode == 200) {
// If the call to the server was successful, parse the JSON
return print(responseData);
} else {
// If that call was not successful, throw an error.
throw Exception('Failed to load post');
}
Run Code Online (Sandbox Code Playgroud)
}
知道如何解决这个问题
更新:
找到解决方案:如果您在本地运行服务器并使用 Android 模拟器,那么您的服务器端点应该是 10.0.2.2:8000 而不是 localhost:8000,因为 AVD 使用 10.0.2.2 …
请解决我的问题。
当我尝试超过 50 次时它会起作用。现在它不起作用我尝试了 100 多次。
我开始这个 -> 新服务器
? Starting to create your Strapi application.
? Choose your installation type Custom (manual settings)
? Choose your main database: MongoDB
? Database name: server
? Host: @cluster0-8tfpd.mongodb.net
? +srv connection: true
? Port (It will be ignored if you enable +srv): 27017
? Username: deep
? Password: *******
? Authentication database (Maybe "admin" or blank):
? Enable SSL connection: true
? Testing database connection...
It might take a minute, please …Run Code Online (Sandbox Code Playgroud)