Keren Keren - 1 year ago 176
Node.js Question

npm.cmd closes instantly after few seconds

I'm learning nodeJs. I managed to run nodejs commands on cmd and it works fine. Now I want to install express framework and for that in the tutorial I'm following it asks to type

sudo install -g express
on npm command prompt. So I typed npm in my windows search, and clicked on it. Right after few seconds less than 3 it closes straight away.

I found that npm.cmd exist in nodejs directory where node.exe found. What could be the problem here. If I were to type the above mentioned command in windows cmd, it says sudo is unrecognized program.SO must I use npm cmd?

Answer Source

After running cmd.exe , I guess you would have node installed but still run node -v , it should respond with the version meaning it's working. Now if you want to explicitly install express.js you just have to run on, the command prompt itself,

npm install express -g.

Anyways you can follow this link from their official website. Hope it helps. Also sudo is a program for Unix like operating systems, just in case you needed it.