You need to generate an crt file too.
openssl req -x509 -nodes -newkey rsa:2048 -days 1825 -out cert.crt -keyout key.key
then
openssl pkcs12 -export -inkey key.key -in cert.crt -out export.p12
if you have a CA file will be
openssl pkcs12 -export -inkey key.key -in cert.crt -certfile ca.crt -out export.p12