# Unable to install nodejs from nodesource apt repo with apt module

**URL:** <https://forum.ansible.com/t/unable-to-install-nodejs-from-nodesource-apt-repo-with-apt-module/21354>\
**Category:** Ansible Project\
**Created:** [May 4, 2016, 6:06pm UTC](https://forum.ansible.com/t/unable-to-install-nodejs-from-nodesource-apt-repo-with-apt-module/21354 "2016-05-04T18:06:07Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![james4](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@james4](https://forum.ansible.com/u/james4)\
**Post date:** [May 4, 2016, 6:06pm UTC](https://forum.ansible.com/t/unable-to-install-nodejs-from-nodesource-apt-repo-with-apt-module/21354/1 "2016-05-04T18:06:07Z")

</div>

Anyone by chance know why this is no longer working on ansible 2.0.0.2?

The apt repo definition is deb [https://deb.nodesource.com/node\_4.x](https://deb.nodesource.com/node_4.x) trusty main

```auto
- name: install packages
  apt:
    name: "{{item}}"
    state: present
    update_cache: true
  with_items: apt_packages
  register: apt

```

TASK [nodejs : install packages] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

task path: /ansible/roles/nodejs/tasks/install.yml:18

ESTABLISH LOCAL CONNECTION FOR USER: root

127.0.0.1 EXEC ( umask 22 && mkdir -p “$( echo $HOME/.ansible/tmp/ansible-tmp-1462384848.3-116158131187976 )” && echo “$( echo $HOME/.ansible/tmp/ansible-tmp-1462384848.3-116158131187976 )” )

127.0.0.1 PUT /tmp/tmpShGiMV TO /root/.ansible/tmp/ansible-tmp-1462384848.3-116158131187976/apt

127.0.0.1 EXEC LANG=en\_US.UTF-8 LC\_ALL=en\_US.UTF-8 LC\_MESSAGES=en\_US.UTF-8 /usr/bin/python /root/.ansible/tmp/ansible-tmp-1462384848.3-116158131187976/apt; rm -rf “/root/.ansible/tmp/ansible-tmp-1462384848.3-116158131187976/” \> /dev/null 2\>&1

failed: [localhost] =\> (item=[u’git-core’, u’nodejs’]) =\> {“failed”: true, “invocation”: {“module\_args”: {“cache\_valid\_time”: null, “deb”: null, “default\_release”: null, “dpkg\_options”: “force-confdef,force-confold”, “force”: false, “install\_recommends”: null, “name”: [“git-core”, “nodejs”], “package”: [“git-core”, “nodejs”], “purge”: false, “state”: “present”, “update\_cache”: true, “upgrade”: null}, “module\_name”: “apt”}, “item”: [“git-core”, “nodejs”], “msg”: “Could not fetch updated apt files”}

What is “Could not fetch updated apt files”? Seem to be working until we had to install the dependencies here ([https://groups.google.com/forum/#!topic/ansible-project/dFRlLiUI4PA](https://groups.google.com/forum/#!topic/ansible-project/dFRlLiUI4PA))

---

<div class="post-metadata">

**Author:** ![james4](https://avatars.discourse-cdn.com/v4/letter/j/9f8e36/32.png) [@james4](https://forum.ansible.com/u/james4)\
**Post date:** [May 4, 2016, 9:54pm UTC](https://forum.ansible.com/t/unable-to-install-nodejs-from-nodesource-apt-repo-with-apt-module/21354/2 "2016-05-04T21:54:34Z")

</div>

Seems to not bespecific to node, but when update\_cache: true.
