简体   繁体   中英

Cannot run node.js program in command prompt

Arch-noobie here. When I try to run a node.js program in windows command prompt by stating its location, it will invariably say "[stated location] is not recognized as an internal or external command, operable program or batch file."

In all answers to similar questions, in all node.js manuals, it is assumed you can just run a node.js file by calling it from its location. There will always be the suggestion of trying some "hello world" example BEFORE establishing a server and so on.

Even if I clean the command prompt with "prompt $ cmd", and then write the whole location manually, I get the same message.

Can anybody help me with this? Thanks in advance.

By default, your node.js should be installed in C:\\Program Files\\nodejs location. Check for it.

Next, look for environment variables to be set at C:\\Program Files\\nodejs\\bin You can follow this link to check for the PATH and environment variables.

Then, restart your system. It should start working.

确保您输入的是 node 而不是 npm

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM