I just installed the nodejs in my laptop and Im not sure how to run a js file in the node. I tried the following mand,
node C:\Program Files\nodejs\file.js
but it shows this error
module.js:474 throw err
Anyone has any idea? Im totally a newbie.
I just installed the nodejs in my laptop and Im not sure how to run a js file in the node. I tried the following mand,
node C:\Program Files\nodejs\file.js
but it shows this error
module.js:474 throw err
Anyone has any idea? Im totally a newbie.
Share Improve this question asked Nov 25, 2016 at 15:38 Muhammad UsmanMuhammad Usman 1151 gold badge2 silver badges11 bronze badges 1- In my case, the problem was that the working directory of the shortcut file that I run node from was the node directory. I removed it so that Windows uses the current directory as the working directory and that fixed it. – Synetech Commented May 14, 2018 at 2:00
1 Answer
Reset to default 5you have to install node modules first.
cd C:\Program Files\nodejs\
npm install
node file.js