-1

I've installed Node.js on Windows 10 using this tutorial. I set the system variable for it as shown below [also explained in this SO post. But when I run the following command in the command prompt, I get the following error:

Error

enter image description here

Nodejs environment variable: enter image description here

UPDATE

I'm just starting with learning Node.js. Below you can find (pics) is the way I'm trying to access Node.js on my windows 10 machine. It's not working. What should I do instead?

enter image description here

Dženis H.
  • 7,284
  • 3
  • 25
  • 44
nam
  • 21,967
  • 37
  • 158
  • 332
  • 1
    You're in the command shell there. That's different than a NodeJS REPL. And that's not what the tutorial said to do. Unrelated, but when information can be posted as test, please post it as text: console output is text. – Dave Newton Oct 05 '18 at 19:31
  • @DaveNewton I'm just starting to learn `nodejs`. I've added an UPDATE section to my post. Could you please explain what should I be doing instead to make it work? – nam Oct 05 '18 at 19:44
  • 1
    You could do what the tutorial says, I guess, at least to start. You seem to have skipped the part where it says to create a file and run it, and instead you're trying to run JS code from the Windows shell (or whatever it's called now). Or you could start up node *then* run JS code from the Node REPL. I just installed it on a Win10 VM and it appears to work fine. – Dave Newton Oct 05 '18 at 20:06
  • What exactly are you trying to do here? – Dženis H. Oct 05 '18 at 21:28
  • 1
    @Bigga_HD This is my day one to start learning node js. So, after installing the node js. I just used the command line window shown in the third figure above and just run the command `console.log('what ever')` but it gives me the error described above. After reading comments from Dave, it seems obviously I'm doing something wrong. But not being used to running any program on command line tools I'm confused what I actually needs to do first. Could you help? – nam Oct 05 '18 at 21:45
  • Okay. Open your regular command prompt and write `node -v` and tell me what does it say :) – Dženis H. Oct 05 '18 at 21:50
  • 1
    @Bigga_HD Command you suggested gives the output: `v8.12.0` – nam Oct 05 '18 at 21:59
  • Great, you have `NodeJS` installed on your system. Look at my answer. Good luck ;) – Dženis H. Oct 05 '18 at 22:15

1 Answers1

1

If you've correctly installed NodeJS on your machine you should be able to do the following:

  • Go to start and search for Node.js [ a 'desktop app' should appear with a green icon having the exact same name you entered -Can't miss it :) ]
  • I suggest opening it as an administrator -[not really necessary, but to avoid (possible) further problems ]
  • Open that, and try typing the same command e.g. console.log('What about now? :)')

Since you like pictures, here you go :)

enter image description here

Dženis H.
  • 7,284
  • 3
  • 25
  • 44