Strapi:调试 ?? 服务器无法正常启动

Dee*_*hya 3 debugging mangodb server flutter strapi

请解决我的问题。

当我尝试超过 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 have a coffee ??

The app has been connected to the database successfully!

?  Application generation:
? Copy dashboard
? Install plugin settings-manager.
? Install plugin content-type-builder.
? Install plugin content-manager.
? Install plugin users-permissions.
? Install plugin email.
? Install plugin upload.
? Link strapi dependency to the project.

? Your new application server is ready at E:\Dev. Project\Flutter\flutter_ecommerce\server.

?? Change directory:
$ cd server

?? Start application:
$ strapi start  
Run Code Online (Sandbox Code Playgroud)

但问题是-> stripi start

[2019-06-15T09:34:30.604Z] 调试 ?? 服务器无法正常启动。[2019-06-15T09:34:30.609Z] 错误请确保您的 MongoDB 数据库正在运行...

小智 5

看图

你应该添加一个条目uri到你的./config/environment/.../database.json

uri 应该 mongodb://<host>:<port>/<database name>


小智 2

如果您在使用 docker 时遇到此错误,添加--network=host可以解决此问题。请记住,仅在本地使用此解决方案。

正如 docker 本身所描述的那样,

--network="host" 使容器能够完全访问本地系统服务(例如 D-bus),因此被认为是不安全的。