Thanks all. In JS, doing string substitution also seemed to work:
process.env.PRIVATE_KEY.replace(/\\n/gm, "\n")