[nodemon] starting node ./index.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module ‘.env’
Require stack:
- C:\Users\User\Desktop\mongoDB\mflix-js\index.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
at Function.Module._load (node:internal/modules/cjs/loader:778:27)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object. (C:\Users\User\Desktop\mongoDB\mflix-js\index.js:2:1)
at Module._compile (node:internal/modules/cjs/loader:1105:14)
at Object.Module._extensions…js (node:internal/modules/cjs/loader:1159:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) {
code: ‘MODULE_NOT_FOUND’,
requireStack: [ ‘C:\Users\User\Desktop\mongoDB\mflix-js\index.js’ ]
}
[nodemon] app crashed - waiting for file changes before starting…
My .env file code is below:
SECRET_KEY=super_secret_key_you_should_change
MFLIX_DB_URI=mongodb+srv://mdnadim:hiddingpasswoard@cluster0.rydkou5.mongodb.net/sample_mflix
MFLIX_NS=sample_mflix
PORT=5000
and my index.js file code is below:
require("@babel/register")
require(".env").config()
exports = module.exports = require("./src")
Can you tell me where is the problem? Thanks in advance