0

When I install nodejs I download the following file:

node-v5.5.0-x64.msi

However, when I run "node -v"

 v0.12.2

I downloaded some tutorial code on nodejs and I see they use the new javascript "let" statement instead of the old "var" keyword.

However, when I try to execute the javascript code in the tutorial, it does not work until I change all the "let" to "var".

Then it works.

(1) What version of nodejs did I download? v0.12 or v5?

(2) Should it support the new "let" statement?

(3) Is there a different version I can download that supports the "let" statement?

Thanks

Siegfried

Siegfried
  • 695
  • 1
  • 9
  • 24
  • 2
    You may have multiple versions of node in your PATH and the ones that's running by default is 0.12.2 I'd suggest you find where the newer version is and amend your path to use that first, or if you need both then look at something like NVM for Windows (I'm inferring you are on Windows from the .msi extension in your post) to manage multiple versions of node https://github.com/coreybutler/nvm-windows – Simon Prickett Feb 05 '16 at 21:30
  • Also this may be of use http://kangax.github.io/compat-table/es6/ – Simon Prickett Feb 05 '16 at 21:32

1 Answers1

1

What you're looking at in that filename is not actually Node.JS' version or NPM's version, but the release version of the installer bundle.

If you're having PATH issues, as it seems you are, you can just let Node update itself:

npm update node
npm update npm

And that will make the version in your PATH the latest version.


Otherwise you can edit your environment variables manually:

See Editing PATH variable on Mac or Windows 7 - Add Path for more information on how to do that.

Community
  • 1
  • 1
Quill
  • 2,729
  • 1
  • 33
  • 44
  • Thanks! I can now execute that tutorial code. However, I still get 0.12.2 from node -v. Apparently this is the bundle version? How do I get the node version? – Siegfried Feb 06 '16 at 20:17
  • So node - v is node's version and npm -v is node package manager's version – Quill Feb 06 '16 at 20:18
  • Shucks! After re-installing windows the tutorial samples don't work again! I downloaded and installed node-v5.6.0-x64.msi and now node -v says 5.6. Good. – Siegfried Feb 13 '16 at 16:34
  • Shucks! I had the problem fixed and then I had to reinstall windows and now the tutorial examples with "let" don't work again! So after re-installing windows I installed node-v5.6.0.msi and now the javascript "let" syntax won't work again. I tried your solution of "npm update node" and "npm update npm" and rebooted and "let" still won't work! What am I doing wrong? – Siegfried Feb 13 '16 at 17:01
  • I don't know, to be honest. You might try posting another question – Quill Feb 13 '16 at 21:58