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 of which node would return this path and all its changes. Is it possible somehow to evaluate the content of command 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:
$(which node)
would, under Bash, return the path.
```json
"frontMatter.custom.scripts": [
{
"command": "~/.nvm/versions/node/v20.18.0/bin/node",
"script": "./bin/frontmatter/screenshot-header-image.cjs",
"title": "Retrieve Screenshot"
},
]
```
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 of `which node` would return this path and all its changes. Is it possible somehow to evaluate the content of `command` 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:
```bash
$(which node)
```
would, under Bash, return the path.
<!-- github-sync-id:2616632746 -->
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:
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.
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:
```json
"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.
<!-- github-comment-id:2441096218 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
I have a custom script like the above that relies on the
commandattribute. 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 nodewould return this path and all its changes. Is it possible somehow to evaluate the content ofcommandso 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
nodein 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.
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
$PATHvariables are available. I've tried thewhich nodecommand, 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 nodecommand.Configuration of the custom script can then be changed to:
On my device, this approach works as I have
zshconfigured and that path is used for thewhich nodecommand.If there is no configuration, it would still be the same experience as before.