Node.js version on the command line? (not the REPL)

后端 未结 13 997
不思量自难忘°
不思量自难忘° 2020-12-07 08:01

I want to get the version of Node.js on the command line. I\'m expecting to run a command like:

node -version

but that doesn\'t work. Does

13条回答
  •  清歌不尽
    2020-12-07 08:41

    If you're referring to the shell command line, either of the following will work:

    node -v
    
    node --version
    

    Just typing node version will cause node.js to attempt loading a module named version, which doesn't exist unless you like working with confusing module names.

提交回复
热议问题