Check for current Node Version

后端 未结 9 1896
温柔的废话
温柔的废话 2021-01-31 06:48

I need to programmatically access the current node version running in a library I am writing. Can\'t seem to find this in the docs.

9条回答
  •  故里飘歌
    2021-01-31 07:28

    process.version.match(/^v(\d+\.\d+)/)[1]

    if process.version is 'v0.11.5', then get 0.11 .

提交回复
热议问题