Skip to content

Commit

Permalink
Install nvm the recommended way
Browse files Browse the repository at this point in the history
  • Loading branch information
joffotron committed Jul 12, 2021
1 parent 6e276ea commit 8a35495
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion joff.yml
Expand Up @@ -32,7 +32,7 @@
- { role: profile-all, tags: base }
- { role: profile-developer, tags: base-dev }
- { role: docker, tags: docker }
- { role: roderik.superlumic-node, tags: nodejs }
- { role: nodejs, tags: nodejs }
- { role: ruby, tags: ruby }
- { role: golang, tags: golang }
# - { role: elixir, tags: elixir }
Expand Down
24 changes: 24 additions & 0 deletions roles/nodejs/tasks/main.yml
@@ -0,0 +1,24 @@
---

- name: install node
homebrew: name={{item}} state=latest
with_items:
- node

- name: create nvm directory
file:
path: "{{ home_dir }}/.nvm"
state: directory

- name: copy nvm-exec to NVM's working directory
shell: cp $(brew --prefix nvm)/nvm-exec ~/.nvm/ creates=~/.nvm/nvm-exec

- name: Install nvm in the recommended way
command: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash

- name: install other node versions via nvm
shell: ". {{ home_dir }}/.nvm/nvm.sh; nvm install {{item}}"
with_items: "{{node_versions}}"

- name: st the default node version
shell: ". {{ home_dir }}/.nvm/nvm.sh; nvm alias default {{default_node_version}}"
2 changes: 1 addition & 1 deletion roles/zsh/templates/zshrc.j2
Expand Up @@ -111,7 +111,7 @@ source $ZSH/oh-my-zsh.sh
eval "$(rbenv init -)"

export NVM_DIR=~/.nvm
[ -s "$(brew --prefix nvm)/nvm.sh" ] && . "$(brew --prefix nvm)/nvm.sh"
[ -s "$NVM_DIR/nvm.sh" ] && . "NVM_DIR/nvm.sh"

# place this after nvm initialization!
autoload -U add-zsh-hook
Expand Down

0 comments on commit 8a35495

Please sign in to comment.