ndoe-js-cannot-find-module-error-solution or node:internal/modules/cjs/loader:936 throw err; ^(Solution)

osmanforhad

Osman Forhad

Posted on March 3, 2022

ndoe-js-cannot-find-module-error-solution or node:internal/modules/cjs/loader:936 throw err; ^(Solution)

trying to run node js project which is develop in express js and other necessary library. after writing code when i decide to run the project then i wrote the command npm start and alternatively nodemon command. its show me an error which is below screenshot:

node:internal/modules/cjs/loader:936<br>
  throw err;

after this happening i was thinking and search why this is happen and why terminal show me node:internal/modules/cjs/loader:936
throw err;
^

after wasting few times i find out and figured the mistake which is done by me. so i decide to share this with all of you guys (the internet people)
.
so what was the mistake did by me: it was a case of trying to run the file in node from the wrong location.
do you understand.? if answer is no. well i explain here don't worry: here rbac is my project directory and there i have another directory which name was server and inside the server directory i have a file which name also server.js, please keep in mind this is the main point of my mistake.
.
to run this project i need to hit** server.js file by using npm start or nodemon*. in this case i was open my termial inside my main directory which name rbc as i mentioned in previous line and from here i tried to hit server.js file but this file is not in this location. the actual location of server.js file is inside **rbac/server/server.js *
so the terminal show me node:internal/modules/cjs/loader:936
throw err;
^

and when i realize my mistake then i just move server.js file from rbac/server/server.js to rbac/server.js
and then open terminal inside the project root and then run nodemon or npm star and now it's working fine. finally my terminal look like below screenshot and this is the actual view which i want to see.

ndoe-js-cannot-find-module-errorsolution
.
Happy Coding.
osman forhad
Full-Stack Developer💻 (Mobile App & Web App)
developer.osmanforhad@gmail.com

💖 💪 🙅 🚩
osmanforhad
Osman Forhad

Posted on March 3, 2022

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related