Run `nvm` using Deno.Command
Hello, I am trying to run
nvm
from a Deno script using Deno.Command.
but I am getting the following error:
nvm was install with brew and I tried passing env: {PATH: Deno.env.get('PATH')
but nothing works...1 Reply
I wasn't able to find the answer to your question in the official Deno documentation. However, based on the code snippet you've provided, there seems to be a syntax error. The
Deno.Command
constructor does not take the command and options as separate arguments. Instead, you should pass the command as the first element of the args
array. Also, you are not actually calling the outputSync
method; you need to add parentheses to invoke it.
Here's a corrected version of your code snippet:
Please note that this advice is not based on the Deno documentation, and you should double-check the accuracy of the advice given. Additionally, nvm
is a shell function, and it might not be available as a standalone executable in the PATH, which could be why you are encountering the error. You may need to run the command in the context of a shell that has nvm
initialized, such as bash -c 'nvm use'
.