简体   繁体   English

对nodejs版本和javascript版本感到困惑

[英]Confused about nodejs versions and javascript versions

When I install nodejs I download the following file: 安装nodejs时,我下载了以下文件:

node-v5.5.0-x64.msi

However, when I run "node -v" 但是,当我运行“ 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. 我在nodejs上下载了一些教程代码,我看到它们使用新的javascript“ let”语句而不是旧的“ var”关键字。

However, when I try to execute the javascript code in the tutorial, it does not work until I change all the "let" to "var". 但是,当我尝试执行本教程中的javascript代码时,只有将所有的“ let”更改为“ var”后,它才起作用。

Then it works. 然后就可以了。

(1) What version of nodejs did I download? (1)我下载了哪个版本的nodejs? v0.12 or v5? v0.12或v5?

(2) Should it support the new "let" statement? (2)是否应支持新的“让”声明?

(3) Is there a different version I can download that supports the "let" statement? (3)我可以下载支持“ let”语句的其他版本吗?

Thanks 谢谢

Siegfried 齐格弗里德

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. 您在该文件名中查看的实际上不是Node.JS的版本或NPM的版本,而是安装程序捆绑包的发行版。

If you're having PATH issues, as it seems you are , you can just let Node update itself: 如果您遇到PATH问题( 看起来像是) ,可以让Node更新自身:

 npm update node npm update npm 

And that will make the version in your PATH the latest version. 这将使您PATH的版本成为最新版本。


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. 有关如何执行此操作的更多信息,请参见在MacWindows 7 上编辑PATH变量 -添加路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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