req -x509 (without
-new) requires a CSR on input and you don't say anything about having created a CSR.
-key requires a "private-key" file (which in the PKCS#1 CRT form which OpenSSL uses is really keypair) and you say you have that, although it would not normally use a .txt extension.
-nodes are useless when
-key is input; they are for the case where
req generates a new keypair along with the CSR or cert.
You may want to use
req -new -x509 which in effect generates a CSR for your keypair and name and then converts it to a self-signed cert automatically. For that you need to supply the subject Distinguished Name (commonly Organization, CommonName, and so on, but can be configured) and validity, and optionally but usually cert extensions, which vary depending on what your cert is intended for, either in a config file, which can either be specified or use a default that depends on your build/package, or commandline options, or a combination of both.
Did you try reading the manpages for
req and for
x509v3_config to which it refers? There's a reason those total 15 kilobytes which I don't propose to retype here.