Skip to content

Commit

Permalink
[os] Ensure nvm.sh is sourced before npm is called
Browse files Browse the repository at this point in the history
  • Loading branch information
alrra committed Jun 27, 2015
1 parent 670e909 commit 46e1ec7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions os/install_npm_packages.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ declare -r -a NPM_PACKAGES=(

main() {

# Check if `NVM_DIR` is set, and if it's not, it's because
# `~/.bash.local` was not sourced, and therefore, npm won't
# be available (this happens when the `dotfiles` are set up
# for the first time)

if [ -z "$NVM_DIR" ]; then
source "$HOME/.bash.local"
fi

# Check if `npm` is installed
if [ $(cmd_exists "npm") -eq 1 ]; then
print_error "npm is required, please install it!\n"
Expand Down

0 comments on commit 46e1ec7

Please sign in to comment.