I cloned the MERN-STACK backend folder from Github. It is our group project. So That backend is working well when it starts by person who created that. But When I tried to run it showed the following error.
node index.js
(node:81836) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/Users/masterlwa/Desktop/new/ITP_Project__GYMLY/backend/src/index.js:1
import "dotenv/config";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1195:20)
at Module._compile (node:internal/modules/cjs/loader:1239:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Module._load (node:internal/modules/cjs/loader:972:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at node:internal/main/run_main_module:23:47
I installed node modules to that file and tried to run it using node index.js command (index is a server file). But I show the following error. How to fix it?