371273
371273

Reputation: 5436

How to run global npm binaries with Ansible

  1. I've set my npm global install path with npm config set prefix '~/.npm-packages
  2. I've updated my PATH to include this. In ~/.profile I have PATH="$HOME/.npm-packages/bin:$PATH"
  3. I have installed gulp with npm install -g gulp, verifying that it exists in ~/.npm-packages/bin/gulp
  4. I have verified that it is in my PATH and executable by SSHing into my remote machine and typing gulp

I'm using the following Ansible task:

name: Run gulp
command: gulp
args:
  chdir: app/

but it always errors out with the following:

{"cmd": "gulp", "failed": true, "rc": 2}
msg: [Errno 2] No such file or directory

Why am I able to run gulp from a SSH session but not via Ansible?

Upvotes: 1

Views: 3041

Answers (1)

371273
371273

Reputation: 5436

I was finally able to do this with the following.

- name: Run gulp
  command: ~/.npm-packages/bin/gulp
  args:
    chdir: app/

Upvotes: 4

Related Questions