nodists / nodist

Natural node.js and npm version manager for windows.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Setup bashrc instead of bash_profile

mattmccarty opened this issue · comments

My company is in the process of 'dockerizing' all of our applications. On Windows, Docker's CLI uses MingW, so all of our automation scripts are written in bash. One of our bash scripts check's for node installations, if none exist, it will install node using nvm (in *nix environments). Since NVM doesn't work in in MingW (and nvm-windows is buggy), today I've started playing around with Nodist. Upon updating our automation script to utilize Nodist on Windows, I noticed that the 'nodist env' command does not work from the bash script, though, it works if I type is in manually.

After tinkering around a bit, I decided to include (source) the nodist_bash_profile_content.sh script before calling the nodist env command in the bash script. Now it works perfectly. It took me a while to figure this out because the README documentation only references this script in the "Cygwin" section:

cat "$NODIST_PREFIX/bin/nodist_bash_profile_content.sh" >> ~/.bash_profile
source ~/.bash_profile

I was thinking about creating a PR to update the README, however, since I've just started using Nodist, I'm not sure if I missed something. Should the README be updated to include information on using 'nodist env' type commands from within a shell/bash script? Maybe snippet in the cygwin section should be automatically added in all MingW and Cygwin environments?

Hi @mattmccarty, thanks for reporting this. Cygwin needs special treatment, because we don't know where the cygwin installation (and thus the user's home directory) resides. For git bash (and also for mingw, I suppose) nodist's installer sets up the .bash_profile with the necessary contents in the windows home directory, but upon investigation it seems like it should be populating .bashrc instead, to make nodist env work in bash scripts as well.

Awesome. Thanks for looking into it.