问题
Please fix my problem.
It works when I try more than 50 times. Now it does not work I try 100+ times.
I start this -> strapi new server
� 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
But problem is -> strapi start
[2019-06-15T09:34:30.604Z] debug ⛔️ Server wasn't able to start properly. [2019-06-15T09:34:30.609Z] error Make sure your MongoDB database is running...
回答1:
See the picture
You should add an entry uri
into your ./config/environment/.../database.json
uri
should be mongodb://<host>:<port>/<database name>
回答2:
Please make sure your MongoDB is running with the settings you set in your ./config/environment/.../database.json
I think your host have ans issue, @
is not needed.
I suggest you to follow the Strapi doc about Mongo Atlas docs. That work with clusters. https://strapi.io/documentation/3.0.0-beta.x/guides/databases.html#install-on-atlas-mongodb-atlas
回答3:
- Check is MongoDB instance is running
- Check in the settings that
host
is correct:./config/environment/.../database.json
. Usually in development islocalhost
回答4:
If you face this error while working with docker,
Adding --network=host
solves this problem. Keep in mind, use this solution only locally.
As described by docker itself,
--network="host" gives the container full access to local system services such as D-bus and is therefore considered insecure.
来源:https://stackoverflow.com/questions/56609285/strapi-debug-%ef%b8%8f-server-wasnt-able-to-start-properly