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
Posted on 04-18-2020 12:33 AM
Thanks @john.sherrod , very useful!
Posted on 06-06-2025 02:05 PM
Hi @john_sherrod , I have tried this script manually and it works, of course. But having added it as a JAMF EA, it returns zero results in JAMF Pro. I tried the EA as an 'integer' and as a 'string'. I know we have users with Node.js installed, just wondering how to config the EA if I'm doing something wrong?
Posted on 06-09-2025 05:33 AM
Hmmm… I have mine said to “string” since it actually puts a v before the version number. Just verified that it’s still working in my Jamf Pro instance. You’ve got it copied in exactly as I have it above into the EA, right? Just making sure we’ve got the <result></result> in there since Jamf needs that for the EA to work.
Posted on 06-09-2025 06:11 AM
How peculiar. I copied your code above once more and pasted it over the pre-pasted code in JAMF Settings and saw no change, ensured the type was set to String, and identified 'Which Node installed?" as a new display item. I now see either "Node.js is not installed" or blank (nothing) for the inventory. So, it's working partway now, which is excellent, thank you.
Posted on 06-09-2025 07:57 AM
Gotta love how if one tiny little thing is off it completely refuses to understand what you’re trying to do. 😂