I also face this error after for a while debugging my code i get the solutions that it was the problem of my .env file.
first install the package of npm i dotenv after that import it in the main file of your backend:
import * as dotenv from 'dotenv'; dotenv.config();
and run again your project it will run successfully