geerlingguy / ansible-role-nodejs

Ansible Role - Node.js

Home Page:https://galaxy.ansible.com/geerlingguy/nodejs/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Node.js gets uninstalled in Debian Buster.

gentios opened this issue · comments

Hi Geerlingguy,

Thank you for your amazing work and all these ansible roles.

I am using this role to install Node.js >= v8.x in Debian Buster, however after a day when I ssh and I do node -v it returns me Node.js >= 10.x and npm is not there.

Somehow it gets uninstalled and I don't know why.

I am using the role very simply as in the examples:

 - role: geerlingguy.nodejs
         tags: [packages, nodejs]

And with these variables:

vars:
    - nodejs_version: "8.x"
    - nodejs_npm_global_packages:
      - name: pm2
commented

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

I can confirm that behaviour. Unfurtunally it isn't installing the nodejs 8.x on Buster in my case, it is always installing the version from Debian Buster, which is a NodeJS 10. The second run of the role then returns an error in task "Ensure Node.js and npm are installed" saying, that apt cannot downgrade:

msg: 
  '/usr/bin/apt-get -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" install 'nodejs=8.*''
 failed: E: Packages were downgraded and -y was used without --allow-downgrades.

I think, there must be a priority for the package. I would suggest to add the following file to /etc/apt/preferences.d/prefer-nodejs in case of Debian.

Package: *
Pin: origin deb.nodesource.com
Pin-Priority: 1001

See https://wiki.debian.org/AptConfiguration - the german version of the document contains a notice from Jushua Rodman, saying Pin Priority > 1000 makes it possible to downgrade a version without marking the apt-command (I don't know, where the english version of that comment is available)

commented

This issue is no longer marked for closure.

commented

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.