Error script not found when suing ansible playbook to start an application using pm2

0 votes

I have written an ansible task to start my project. Below is the task:

- name: To Start a App
    command: pm2 start index.js --name Tracker-US chdir= /home/ubuntu/tracker-u$
    ignore_errors: yes
    when: npm_finished.changed

I got the following error:

fatal: [18.209.197.33]: FAILED! => {"changed": true, "cmd": ["pm2", "start", "index.js", "--name", "Tracker-US", "/home/ubuntu/tracker-us/"], "delta": "0:00:00.716599", "end": "2019-09-04 05:24:18.904163", "msg": "non-zero return code", "rc": 1, "start": "2019-09-04 05:24:18.187564", "stderr": "[PM2][ERROR] script not found : /home/ubuntu/index.js\nsc