I need to fly from Marrakesh to Barcelona but find that the only nonstop flight is scheduled late at night and doesn't land in Barcelona until 2:00 in the morning, which is just not going to work for me. I have looked at the small airlines such as Ryanair, etc. but there doesn't seem to be any options. Any thoughts?
Not sure what search engine what day you are using I used google flights and found two direct flights one at 930am on ryanair and one at 630pm on Vueling
Both of these go to BCN.
I don't know when you want to fly, and schedules vary a lot by time of year.
Have you checked Skyscanner.com? It's much easier to start with a website that aggregates data from a lot of airlines than to try to guess which individual airline might fly one particular route. One of the airlines on that route is Vueling, but Skyscanner will probably cover all of them.
Do be careful about the specific airports being used. RyanAir in particular is notorious for using airports that are nowhere near the city you're trying to fly into. I think it sometimes uses the Girona airport rather than BCN. Girona is a lovely place, but if your hotel is in Barcelona, you probably don't want to fly into Girona.
As suggested above, try skyscanner. Also, be aware that the schedule varies day-by-day as well as seasonally.
Don't forget that there is an hour difference between Morocco and Spain. If you land in BCN at 2 am, that would be only 1 am in Morocco !