Right now, I'm just trying to set up a YAML script that simply checks if a particular node package is installed or not. The way I currently have it is:
command: npm list selenium-webdriver >/dev/null || npm install selenium-webdriver
However, this always returns:
fatal: [localhost -> localhost]: FAILED! => {"changed": false, "cmd": ["npm", "ls", "selenium-webdriver", ">/dev/null", "||", "npm", "install", "selenium-webdriver"], "delta": "0:00:00.463110", "end": "2017-08-09 12:56:30.359529", "failed": true, "rc": 1, "start": "2017-08-09 12:56:29.896419", "stderr": "npm ERR! code 1", "stdout": "/myDir\n└── (empty)", "stdout_lines": ["/myDir", "└── (empty)"], "warnings": []}
I'm not entirely sure what an "npm ERR! code 1" error even is.
I tried to shorten it to see what the error might be, can it seems to be the argument:
npm list selenium-webdriver
I was hoping that it would run the first command, and IF that failed, then run the second command (the installation).
How exactly do I go about doing such that this command acts in the manner I'm looking for?