Skip to content

Commit

Permalink
fix: use prefix instead of bin (#205)
Browse files Browse the repository at this point in the history
`npm bin` was removed as part of npm [v9.0.0](https://github.com/npm/cli/releases/tag/v9.0.0).

Also npm first [deprecated](npm/cli#4879) `--global` but has since [undeprecated](npm/cli#4982) it.
  • Loading branch information
akikanellis authored Jan 4, 2023
1 parent cab533b commit a4c6146
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ansible/roles/all/templates/users/aki/zsh/functions.zsh.j2
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function update() {

if command_exists npm; then
echo "Updating npm..."
npm update --location=global
npm update --global
echo "npm updated!"
fi

Expand Down
8 changes: 4 additions & 4 deletions ansible/roles/common/tasks/asdf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,16 @@
pip_executable: "{{ which_pip.stdout }}"
when: "'python' in asdf_plugins_names"

- name: Discover "aki" user npm binaries directory
- name: Discover "aki" user npm prefix
become_user: aki
ansible.builtin.command:
cmd: >
zsh -c "source ~/.asdf/asdf.sh && direnv exec ~ npm bin --location=global"
register: npm_bin_result
zsh -c "source ~/.asdf/asdf.sh && direnv exec ~ npm prefix --global"
register: npm_prefix_result
changed_when: false
when: "'nodejs' in asdf_plugins_names"

- name: Set npm binaries directory
ansible.builtin.set_fact:
npm_binaries_dir: "{{ npm_bin_result.stdout }}"
npm_binaries_dir: "{{ npm_prefix_result.stdout }}/bin"
when: "'nodejs' in asdf_plugins_names"
2 changes: 1 addition & 1 deletion ansible/roles/common/tasks/npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
ansible.builtin.command:
cmd: >
zsh -c "source ~/.asdf/asdf.sh &&
direnv exec ~ npm install --location=global {{ item }}"
direnv exec ~ npm install --global {{ item }}"
creates: "{{ npm_binaries_dir }}/{{ item }}"
loop: "{{ package_names }}"

0 comments on commit a4c6146

Please sign in to comment.