admin 管理员组

文章数量: 1086019

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
Add a ment  | 

1 Answer 1

Reset to default 5

you have to install node modules first.

cd C:\Program Files\nodejs\
npm install
node file.js

本文标签: javascriptmodulejs 474 throw errStack Overflow