Extension Attribute for Determining if Node.js is Installed and Displaying the Version if So
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on
01-07-2019
01:28 PM
- last edited on
03-04-2025
05:16 AM
by
kh-richa_mig
We had a need to do an inventory of which of our Macs has Node.js installed and to display the Node.js version. I wanted to share this in case it's helpful for anyone else. Basically it checks to see if /usr/local/bin/node is present and if so it runs a command to display the version number. Here's the script:
#!/bin/bash
# Tests to see if Node.js is installed. If it is, it outputs the version number. If it’s not, it states that Node.js is not installed.
if [ -f "/usr/local/bin/node" ]
then
echo "<result>`node -v`</result>"
else
echo "<result>Node.js is not installed</result>"
fi
Reply
1 REPLY 1

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Posted on 04-18-2020 12:33 AM
Thanks @john.sherrod , very useful!
Reply
