Open AxisNL opened 2 years ago
IMO it's best to avoid non-distribution package repos if possible. I use this module like this on Debian:
class { 'nodejs':
manage_package_repo => false,
npm_package_ensure => present,
}
Issue still exist and the reason is puppet itself. Found via debug run (CentOS 8 Stream system):
Debug: Executing: '/bin/rpm -q npm --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n'
Debug: Executing: '/bin/rpm -q npm --nosignature --nodigest --qf %{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\n --whatprovides'
Notice: /Stage[main]/Nodejs::Install/Package[npm]/ensure: current_value '2:16.20.1-1nodesource', should be 'absent' (noop) (corrective)
So the problem is that package also checks for whatprovides
and because of that removed the nodejs package again. Properly the same issue on Debian / Ubuntu and other OSs. Only happens with the nodesource packages since npm in bundled in the nodejs package from them.
Current workaround would be to use nodejs::npm_package_name: false
to ensure that Package[npm]
is not manged at all and hope that other dependencies do not break. See https://github.com/voxpupuli/puppet-nodejs/blob/30161b2671e4c0a2d7a397369a6353c1b4df9e61/manifests/install.pp#L47-L52
I'm pulling my hair out on issues with npm and nodejs on my Ubuntu 20.04.03 LTS machines..
If I run:
The nodesource repo will be added (which is fine), then the nodejs package will be installed (which is fine). The nodesource nodejs package provides npm. Perfect!
At this point, dpkg -l will show the nodejs package being installed, and the npm package isn't installed.
But, after this, puppet will remove the npm package, since the default setting for npm_package_ensure is absent. This somehow removes the nodejs package (not fine). No idea how this works, since according to apt the npm package isnt installed. But puppet says:
Notice: /Stage[main]/Nodejs::Install/Package[npm]/ensure: removed (corrective)
And /usr/bin/npm is gone, as is the nodejs package.
If I do:
Then that will fail. Nodejs will be installed from the nodesource repo, but the npm package only exists in the Ubuntu repo's, and that cannot be installed because it conflicts with the nodesource nodejs package.
So I'm in kind of a loop here!
Affected Puppet, Ruby, OS and module versions/distributions