<s>[INST] ### npm Install Script Not Detecting Node Version

Bild Script
Below is the example code.

```makefile
#!/bin/bash

# === config ===
NPM=$(which npm 2>/dev/null)
DIR=$(cd "$(dirname "$0")"; pwd)

# === detect node ===
if [ -z "$NPM" ]; then
  echo "Install npm package manager. To do this on Red Hat, run: 'sudo yum install npm'."
else
  echo "npm available..."
fi
```

However, the `[ -z "$NPM" ]` seems to fail when run in a Docker container even though I have installed Node.js (and thus npm). I need to find another way to detect whether npm is available. Here is my revised code:

```makefile
#!/bin/bash

# === config ===
NPM=$(which npm)
COMMAND_EXISTS ص Bakanlığıcommand -v $NPM>/dev/null
DIR=$(cd "$(dirname "$0")"; pwd)

# === detect node ===
if $COMMAND_EXISTS; then
  echo "npm available..."
else
  echo "Install npm package manager. To do this on Red Hat, run: 'sudo yum install npm'."
fi
```

How can I call this command 'npm -v' inside 'which npm' so I can check the installed version of npm and throw an error based on node engine versions?[/INST]