Skip to content

Commit a4c6146

Browse files
authored
fix: use prefix instead of bin (#205)
`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.
1 parent cab533b commit a4c6146

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

ansible/roles/all/templates/users/aki/zsh/functions.zsh.j2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ function update() {
4646

4747
if command_exists npm; then
4848
echo "Updating npm..."
49-
npm update --location=global
49+
npm update --global
5050
echo "npm updated!"
5151
fi
5252

ansible/roles/common/tasks/asdf.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,16 +95,16 @@
9595
pip_executable: "{{ which_pip.stdout }}"
9696
when: "'python' in asdf_plugins_names"
9797

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

107107
- name: Set npm binaries directory
108108
ansible.builtin.set_fact:
109-
npm_binaries_dir: "{{ npm_bin_result.stdout }}"
109+
npm_binaries_dir: "{{ npm_prefix_result.stdout }}/bin"
110110
when: "'nodejs' in asdf_plugins_names"

ansible/roles/common/tasks/npm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@
88
ansible.builtin.command:
99
cmd: >
1010
zsh -c "source ~/.asdf/asdf.sh &&
11-
direnv exec ~ npm install --location=global {{ item }}"
11+
direnv exec ~ npm install --global {{ item }}"
1212
creates: "{{ npm_binaries_dir }}/{{ item }}"
1313
loop: "{{ package_names }}"

0 commit comments

Comments
 (0)