Please, I need help accessing Nodejs from the command line. Anytime I try to initiate a command on the command line, I am directed back to my Editor. I can’t even check the Version of Node using the following command { Node --version}
My path variable is as follows : C:\Program Files\ nodejs
I opened the Folder(Nodejs) on the visual studio code editor
I created a new file inside the folder(nodevoyage.js)
I added a few lines of code
I tried to run it on the command line … {node nodevoyage.js}
Now here is the issue: any time I get to step 5, the code doesn’t run but redirects me back to a blank file (node.js) that appears on my editor. Please refer to the screenshots. I really want to know what i am doing wrong. Thanks!
You don’t need to initialize npm to run a simple js file with node , @2virtual seems to be doing correctly, what I think is that there is some type of corruption with his node installation, node -v should always give you the correct node version installed, I suggest a complete uninstall and reinstall of the Lts version downloaded directly from the node website, and follow the instructions for windows should be straightforward, never had such a problem with several installations on windows 10.