I can't run a Conda command using exec with my NodeJS app.
var conda_path = '~/miniconda3/bin/conda' var cmd = conda_path + ' init bash & ' + conda_path + ' activate XYZ' exec(command, function(error, stdout, stderr){ } ); I get the following error:
/bin/sh: /Users/username/Desktop/repos/project/XYZ: is a directory
CommandNotFoundError: Your shell has not been properly configured to use 'conda activate'. To initialize your shell, run
$ conda init <SHELL_NAME>Currently supported shells are: - bash - fish - tcsh - xonsh - zsh - powershell
See 'conda init --help' for more information and options.
IMPORTANT: You may need to close and restart your shell after running 'conda init'.
I can find no related information online regarding running conda commands from NodeJS app.
How can I make this work?
conda runas shown in this answer, which circumvents having to manually activate. If you are trying to manipulate Conda envs programmatically, then I suppose that's a different story.conda run. Also,conda initis really only meant to be run once and has a user-level side-effect of editing the shell initialization script - fortunately it's idempotent, but it's a waste here. You should actually look at the code it generates to see how to initialize a shell session.