@@ -25,14 +25,6 @@ preInstall:
25
25
exit 1
26
26
fi
27
27
28
- LOWEST_SUPPORTED_MAJOR_NODE_VERSION=16
29
- NODEJS_BINARY_PATH=$(command -v node)
30
- INSTALLED_MAJOR_NODE_VERSION=$($NODEJS_BINARY_PATH -v | awk -F '[^0-9]+' '{ print $2 }')
31
- if [ "$INSTALLED_MAJOR_NODE_VERSION" -lt "$LOWEST_SUPPORTED_MAJOR_NODE_VERSION" ]; then
32
- echo "Error: Node.js version not supported. Please upgrade to the latest supported version." >&2
33
- exit 132
34
- fi
35
-
36
28
ASSERT_NPM_INSTALLED=$(sudo -i -u $SUDO_USER command -v npm)
37
29
if [ -z "$ASSERT_NPM_INSTALLED" ] ; then
38
30
exit 2
@@ -121,6 +113,7 @@ install:
121
113
label : ' Finding Node processes and installing Node agent'
122
114
cmds :
123
115
- |
116
+ LOWEST_SUPPORTED_MAJOR_NODE_VERSION=16
124
117
FOUND_PROCESSES=$(sudo -i -u $SUDO_USER newrelic-introspector-node list)
125
118
if [ "$FOUND_PROCESSES" == "" ] || [ "$FOUND_PROCESSES" == "[]" ]; then
126
119
echo "No Node processes found running on the host" >&2
@@ -130,6 +123,12 @@ install:
130
123
for PID in "${PROCESSES[@]}"
131
124
do
132
125
INTROSPECTION_DATA=$(sudo -i -u $SUDO_USER newrelic-introspector-node introspect --pid ${PID})
126
+ INSTALLED_MAJOR_NODE_VERSION=$(echo "${INTROSPECTION_DATA}" | grep -oP '.*\K(?<=node_version":").*?(?=\")' | cut -d. -f1)
127
+ if [ "$INSTALLED_MAJOR_NODE_VERSION" -lt "$LOWEST_SUPPORTED_MAJOR_NODE_VERSION" ]; then
128
+ echo "Error: Node.js version not supported. Please upgrade to the latest supported version." >&2
129
+ exit 132
130
+ fi
131
+
133
132
COMMAND=$( echo "${INTROSPECTION_DATA}" | grep -oP '.*\K(?<=pm_exec_path":").*?(?=\")' )
134
133
135
134
if [[ "{{.NEW_RELIC_ASSUME_YES}}" != "true" ]]; then
0 commit comments