Posted on 01-07-2019 01:28 PM
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
Posted on 04-18-2020 12:33 AM
Thanks @john.sherrod , very useful!