Reading. Read the genre you want to write about. It will give insights to the writing aspects. Then write. A lot. Everyday. Even if it's just an hour a day. Writing is like a muscle. You have to to use it.
Having a good story idea. Grammar, etc can be fixed. You want an idea that makes the reader excited to read the book. Also, the characters have to have a connection. If it's a romance, they should have chemistry. Another thing is emotion. The story should make the reader feel something. Sad, happy, excited, etc.
When I published my first book, I was still learning. Being an Indie author, I do everything myself so it was quite the learning experience. After I published my first book, and started writing the second one, I learned even more. The process of writing became easier for me in all ways. Fast forward to the present, I have definitely grown as a writer.
It wasn't an easy experience but now looking back, I realize that it was well worth it. It changed my process of writing in that I am more organized. I have the book cover, and title before I start to write the story. My editing is tighter as well and I am better at the keywords when entering my genre.
Fortunately no but I do have tips in case it should happen or for those who is has happened to. Don't get frustrated. I suggest leaving the computer or notebook for a bit and do something to take your mind off of it. Another tip is to just write something. Take an image and put a story to it. Doesn't matter if it's good or not, just get those creative juices flowing. Another tip is to read. Pick a book you want to read and let your mind enjoy. The next day go back to drawing board and see if you can come up with some story ideas. The main thing is not to get upset about it. The idea will come.