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:
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.
.
Happy Coding.
osman forhad
Full-Stack Developer💻 (Mobile App & Web App)
developer.osmanforhad@gmail.com
Top comments (8)
Hii, i also done like you but its not working. i did everything deleting node modules again installed. but i dont know what is the issue. inside the ecommerce folder i have 2 folder backend and client. please give the solution
PS D:\react-projects\ecommerce-nodejs\backend> npm start
[nodemon] 2.0.16
[nodemon] to restart at any time, enter
rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting
node index.js
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'jsonwebtoken'
Require stack:
"scripts": {
"start": "nodemon script.js"
}
write your scripts like above where scripts.js is your app entry file which name could be anything as you like (app,js or server.js or scripts.js) anything
Hii
I have done the same but it still show the same error.
have you find out the solution??
no need to do as like as me.. just read the article and understand what i actually i want to share to solve like this type of issues
please give the suggestion for this
Hii, i also done like you but its not working. i dont know what is the issue. inside the ecommerce folder i have 2 folder backend and frontend. please give the solution
node:internal/modules/cjs/loader:936
throw err;
^
Error: Cannot find module 'mongose'
Require stack:
Hii
I have done the same but it still show the same error.