Using VS Code on Linux Mint, I'm trying to npm run a bash script from within VS code, but I get an error;
ls: cannot access '/usr/bin/convert': No such file or directory
The terminal process "/usr/bin/bash '-l', '-c', 'npm run icons'" terminated with exit code: 2.
My script works fine in a command terminal. More details below. I've come to the conclusion the command is running inside some container that doesn't have access to the host directories.
So, how can I fix this?
I've looked through the 25 similar posts to review before posting, and don't see an exact match. Though, I wonder if I might need a tasks.json file?
DETAILS....
I've added the following to ~/.profile , guessing it's some kind of shell/path issue. I echo these within the script, and see they are as expected when the script runs.
PATH="/usr/bin:$PATH"
LD_LIBRARY_PATH="/lib:$LD_LIBRARY_PATH"
I've tied it into my project using the following in package.json;
"scripts": {
"icons": "./generate-icons.sh",
generate-icons.sh (whittled down to the pertinent issue) is;
#!/usr/bin/env bash
# -------------------------------------------------
# Generate all required PNGs (and optional .ico) from logo.svg
# -------------------------------------------------
set -x
set -euo pipefail # stop on errors
echo "PATH = $PATH"
#echo "LD_LIBRARY_PATH = $LD_LIBRARY_PATH"
# Prefer `magick` if it exists, otherwise fall back to `convert`
#IMG_CMD=$(command -v magick || command -v convert)
#echo "IMG_CMD = $IMG_CMD"
#IMG_CMD="/usr/bin/convert-im6.q16"
IMG_CMD="/usr/bin/convert"
echo "IMG_CMD = $IMG_CMD"
ls -l "$IMG_CMD"