Open davidsneighbour opened 5 days ago
Thanks, @davidsneighbour. for suggesting this. The issue is on VS Code and how it starts the shell. It works with a "nologin" instance. That way, no $PATH
variables are available. I've tried the which node
command, but even then its not possible to find it.
What I've tried is to retrieve the terminal settings' path in the following order:
terminal.integrated.automationProfile.<platform>
terminal.integrated.defaultProfile.<platform>
terminal.integrated.profiles.<platform>
terminal.integrated.shell.<platform>
The first one containing a path/configuration, is used for the execution of the which node
command.
Configuration of the custom script can then be changed to:
"frontMatter.custom.scripts": [{
"command": "node",
"script": "./bin/frontmatter/screenshot-header-image.cjs",
"title": "Retrieve Screenshot"
}]
On my device, this approach works as I have zsh
configured and that path is used for the which node
command.
If there is no configuration, it would still be the same experience as before.
I have a custom script like the above that relies on the
command
attribute. The problem is that this path/command might change over time, and I am forced to update this configuration every now and then. Technically speaking, the return value ofwhich node
would return this path and all its changes. Is it possible somehow to evaluate the content ofcommand
so that the resulting path doesn't need to be changed every time?I remember adding this line because VSCode somehow doesn't respect/find my node/npm versions. They are in "the path," so when I run
node
in the VSCode terminal, it runs the proper version—just not in those custom scripts. Maybe I am doing something else wrong in the VSCode configuration.Edit: something like this:
would, under Bash, return the path.