geerlingguy/ansible-role-nodejs

Installation of node 8.x not working for CentOS7

krisdante opened this issue · 11 comments

node_version: "8.x" fails with error:

TASK [geerlingguy.nodejs : Ensure Node.js and npm are installed.] ******************************************************************************************************************************************
fatal: [10.10.1.131]: FAILED! => {"changed": false, "failed": true, "msg": "No package matching 'nodejs-8.*' found available, installed or updated", "rc": 126, "results": ["No package matching 'nodejs-8.*' found available, installed or updated"]}

Hmm, it seems like it could be that NodeSource is catering first towards Ubuntu/Debian support: https://github.com/nodesource/distributions

It looks like there might currently be issues with the 7.x and/or 8.x repos for CentOS/yum: nodesource/distributions#517

I've pushed up a test branch to see how 8.x fares against all the currently-supported OSes: https://travis-ci.org/geerlingguy/ansible-role-nodejs/builds/268229930

It looks like 8.x is working now, at least—the build above passed without issue.

I should probably update this role's default to at least 6.x as that's current LTS, right?

Also, can officially drop support for Ubuntu 12.04.

ebel commented

I am still getting this error. Looks like it supposed to be fixed ?

030 commented

Issue seems to be persistent although the 71-test-v8.x branch is used

fatal: [127.0.0.1]: FAILED! => {"changed": false, "msg": "No package matching 'nodejs-8.*' found available, installed or updated", "rc": 126, "results": ["No package matching 'nodejs-8.*' found available, installed or updated"]}

Still not working on centos 7.3. I had to change redhat yml file with following

- name: Ensure Node.js and npm are installed.
  yum: "name=nodejs state=latest enablerepo='nodesource'"

It seems this has been fixed by nodesource at some point—I've been able to test 8.x, 9.x, and 10.x on CentOS 7... but I was running through a bunch of other tests, so if I'm missing something, please feel free to re-open and we can take another look.

Still happening with me when trying to use Node 8.x

I'm also seeing this on 9.x. Using CentOS 7 and nodejs_version set to 9.x.

Full error:

fatal: [host]: FAILED! => {"changed": false, "msg": "No package matching 'nodejs-9.*' found available, installed or updated", "rc": 126, "results": ["No package matching 'nodejs-9.*' found available, installed or updated"]}

Checking the repo, it looks like the package doesnt have a version on the end of it (its just "nodejs")

Also, possibly unrelated, but since the nodesource-release RPM's are named the same regardless of what version you install, if you decide to install 6.x, and then later change your playbook to use 9.x, it will not update the .repo file with the new path (will not reinstall the nodesource-release rpm).

I actually found the problem I was having. I Originally had nodejs_version set to 6.x, and then later changed to 9.x. The repo was never updated, and after manually removing the nodesource package, it left behind some cache files. The repomd.xml file was NEWER on 6.x than on the 9.x repo, causing it to not update the cache. manually running a yum clean all; yum makecache resolved it for me.

I think this has mostly to do with nodesource's choice of naming all their repo's the same regardless of version. They should really have a separate name for them so cache pollution does not happen.