voxpupuli / puppet-nodejs Goto Github PK
View Code? Open in Web Editor NEWPuppet module to install nodejs and global npm packages
Home Page: https://forge.puppet.com/puppet/nodejs
License: Apache License 2.0
Puppet module to install nodejs and global npm packages
Home Page: https://forge.puppet.com/puppet/nodejs
License: Apache License 2.0
Guys I have a question:
Is there a way to disable node.js-devel repo for Ubuntu? Now when I install nodejs through puppet with:
class { "nodejs":
version => "latest",
manage_repo => true,
}
I get newest version of nodejs from node.js-devel but I want to use stable version.
I don't understand why you added both repositories.
Best regards.
Currently the npm defined type uses some quite ugly blocks of code. Quite apart from the fact that this could put people off eating their dinner (which is probably quite delicious), things could be a simpler and more robust if a Custom Type was used instead, with nodejs::npm simply making calls to this custom type. Ideally most of code that invokes npm should be same in both the provider and in the defined type with the exception of one or two attributes.
On a fresh puppet install, the following manifest will not compile,
class {
'nodejs':
repo_url_suffix => 'node_0.12',
legacy_debian_symlinks => true;
}
Error is
Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::apt for node.example.net at /home/ff/.puppetlabs/etc/code/modules/nodejs/manifests/repo/nodesource/apt.pp:11:3 on node node.example.net
Puppet 4.2.3
class { 'nodejs':
repo_url_suffix => 'node_4.x',
npm_package_ensure => 'latest',
}
leads to:
Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install npm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
npm : Depends: nodejs but it is not going to be installed
Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
Depends: node-ansi but it is not going to be installed
Depends: node-archy but it is not going to be installed
Depends: node-block-stream but it is not going to be installed
Depends: node-fstream (>= 0.1.22) but it is not going to be installed
Depends: node-fstream-ignore but it is not going to be installed
Depends: node-github-url-from-git but it is not going to be installed
Depends: node-glob (>= 3.1.21) but it is not going to be installed
Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
Depends: node-inherits but it is not going to be installed
Depends: node-ini (>= 1.1.0) but it is not going to be installed
Depends: node-lockfile but it is not going to be installed
Depends: node-lru-cache (>= 2.3.0) but it is not going to be installed
Depends: node-minimatch (>= 0.2.11) but it is not going to be installed
Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
Depends: node-gyp (>= 0.10.9) but it is not going to be installed
Depends: node-nopt (>= 2.1.1) but it is not going to be installed
Depends: node-npmlog but it is not going to be installed
Depends: node-once but it is not going to be installed
Depends: node-osenv but it is not going to be installed
Depends: node-read but it is not going to be installed
Depends: node-read-package-json (>= 1.1.0) but it is not going to be installed
Depends: node-request (>= 2.25.0) but it is not going to be installed
Depends: node-retry but it is not going to be installed
Depends: node-rimraf (>= 2.2.2) but it is not going to be installed
Depends: node-semver (>= 2.1.0) but it is not going to be installed
Depends: node-sha but it is not going to be installed
Depends: node-slide but it is not going to be installed
Depends: node-tar (>= 0.1.18) but it is not going to be installed
Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Error: /Stage[main]/Nodejs::Install/Package[npm]/ensure: change from purged to latest failed: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install npm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
npm : Depends: nodejs but it is not going to be installed
Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
Depends: node-ansi but it is not going to be installed
Depends: node-archy but it is not going to be installed
Depends: node-block-stream but it is not going to be installed
Depends: node-fstream (>= 0.1.22) but it is not going to be installed
Depends: node-fstream-ignore but it is not going to be installed
Depends: node-github-url-from-git but it is not going to be installed
Depends: node-glob (>= 3.1.21) but it is not going to be installed
Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
Depends: node-inherits but it is not going to be installed
Depends: node-ini (>= 1.1.0) but it is not going to be installed
Depends: node-lockfile but it is not going to be installed
Depends: node-lru-cache (>= 2.3.0) but it is not going to be installed
Depends: node-minimatch (>= 0.2.11) but it is not going to be installed
Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
Depends: node-gyp (>= 0.10.9) but it is not going to be installed
Depends: node-nopt (>= 2.1.1) but it is not going to be installed
Depends: node-npmlog but it is not going to be installed
Depends: node-once but it is not going to be installed
Depends: node-osenv but it is not going to be installed
Depends: node-read but it is not going to be installed
Depends: node-read-package-json (>= 1.1.0) but it is not going to be installed
Depends: node-request (>= 2.25.0) but it is not going to be installed
Depends: node-retry but it is not going to be installed
Depends: node-rimraf (>= 2.2.2) but it is not going to be installed
Depends: node-semver (>= 2.1.0) but it is not going to be installed
Depends: node-sha but it is not going to be installed
Depends: node-slide but it is not going to be installed
Depends: node-tar (>= 0.1.18) but it is not going to be installed
Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
This is on ubuntu trusty tahr.
Currently, using provider => 'npm' without dependency on the nodejs class might result a failure.
Could you release a new version to the forge? we'd love to upgrade to get a bunch of fixes
Thanks!
I am using Scientific Linux 6.4, which is a derivative of Red Hat Enterprise Linux and is similar to CentOS. SL is used extensively at research labs and higher-education institutions.
I was attempting to install Puppet Labs Razor onto a Scientific Linux 6.4 box, and the install failed with the following error. I posted the error to the puppet-razor mailing-list, and they recommended that I file a bug here [1].
root@sl6:~ # puppet apply /etc/puppet/modules/razor/tests/init.pp
Class nodejs does not support Scientific at /etc/puppet/modules/nodejs/manifests/params.pp:55 on node sl6.example.gov
It appears that node.js does not support Scientific Linux:
root@sl6:~ # puppet apply /etc/puppet/modules/nodejs/tests/init.pp
Class nodejs does not support Scientific at /etc/puppet/modules/nodejs/manifests/params.pp:55 on node sl6.example.gov
Please update nodejs to support Scientific Linux.
[1] https://groups.google.com/forum/#!topic/puppet-razor/bJIz1Fs7r7k
The EL packages used here are from an unofficial, no-longer-maintained repo, and are of NodeJS 0.6.x - the current version is 0.10.20 and there's been considerable change (specifically feature additions and optimizations) since then.
I have EL6 NodeJS 0.9.5 packages that work, and if similar isn't in EPEL yet, I can try to get them there (I was working with a maintainer for a while...). On EL5, however, it doesn't appear that current NodeJS will build at all.
Hi, if you look at this module at puppetforge, it says that version 0.8.0 is the latest:
https://forge.puppetlabs.com/puppetlabs/nodejs
It appears this module still uses node 0.6.
If you aren't going to keep this module up to date with node.js please note in the Readme that this is for an out of date version.
https://forge.puppetlabs.com/willdurand/nodejs provides an up to date version of node.
Is there a way to use this module to install dependencies on a package.json
file?
If i download the puppetforge puppet/nodejs via the tar.gz download, i get a version which says 1.2.0 in the changelog.
But if i check the file "manifests/init.pp" it is not the same file as in this github repository.
If i download the old(?) puppetlabs/nodejs version which says 0.8.0 in the changelog, the file "manifests/init.pp" is the same as the 1.2.0 version of puppet/nodejs which i downloaded previously.
In other words: puppet/nodejs as version 1.2.0 and puppetlabs/nodejs as version 0.8.0 are (nearly?) the same files when downloaded via tar.gz (maybe also via puppet module
).
Is there a problem in your CI or whatever you use to distribute the module?
Hi,
Apologies - this might be due to me being a puppet noob...
I have this module installed and it seems to install node/npm ok - I now have the latest versions.
However it also seems to give an error:
# puppet nodejs.pp
err: /Stage[main]/Nodejs/Package[npm]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install npm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
npm : Depends: nodejs (>= 0.6.19~dfsg1-3) but it is not going to be installed
Depends: nodejs-dev
Depends: node-node-uuid but it is not going to be installed
Depends: node-request but it is not going to be installed
Depends: node-mkdirp but it is not going to be installed
Depends: node-minimatch but it is not going to be installed
Depends: node-semver but it is not going to be installed
Depends: node-ini but it is not going to be installed
Depends: node-graceful-fs but it is not going to be installed
Depends: node-abbrev but it is not going to be installed
Depends: node-nopt but it is not going to be installed
Depends: node-fstream but it is not going to be installed
Depends: node-rimraf but it is not going to be installed
Depends: node-tar but it is not going to be installed
Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
notice: Finished catalog run in 0.82 seconds
My nodejs.pp file contains
# install puppetlabs/nodejs
# puppet module install puppetlabs/nodejs
#include nodejs
#apt::ppa { "ppa:chris-lea/node.js": }
class { 'nodejs':
# require => Apt::Ppa["ppa:chris-lea/node.js"]
}
#package { 'coffee-script':
# ensure => latest,
# provider => 'npm',
#}
#package { 'forever':
# ensure => latest,
# provider => 'npm',
#}
Is this a know issue? Am I doing something wrong?
Thanks in advance for any pointers.
Cheers,
Chris
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: Could not autoload puppet/type/package: Could not autoload puppet/provider/package/npm: /etc/puppet/environments/development/modules/nodejs/lib/puppet/provider/package/npm.rb:3: syntax error, unexpected ':', expecting $end ...package).provide :npm, parent: Puppet::Provider::Package do
seems this was changed in ce1460c
I have copied a pasted the code from the readme file:
package { 'express':
ensure => present,
provider => 'npm',
}
and I keep getting the following error:
Error: /Stage[main]//Package[express]: Provider npm is not functional on this host
It appears to install on the machine because when I get in I can do npm install or npm -v
I am using:
Node: 0.10.22
Npm: 1.3.14
Centos 6.4
Any ideas of whats going on? Am I missing something that is not in the readme?
Running puppet agent --test
against a puppetmaster with puppetlabs-nodejs v0.8.0 results in the error mentioned. 0.7.1 does not have this problem. Puppet 3.4.3 on master and agent. The following modules installed.
puppet module list
/etc/puppet/modules
├── maestrodev-ssh_keygen (v1.3.1)
├── puppetlabs-apt (v2.2.0)
├── puppetlabs-concat (v1.2.5)
├── puppetlabs-firewall (v1.7.1)
├── puppetlabs-nodejs (v0.8.0)
├── puppetlabs-stdlib (v4.9.0)
└── saz-ssh (v2.8.1)
puppet agent --test
Error: Could not retrieve catalog from remote server: Error 400 on SERVER: undefined method `ref' for nil:NilClass on node `nodename`
I would like to run npm install
in a package dir with no arguments in order to install the dependencies of this package. I do not want to deploy the package dir itself with npm. This corresponds to the first form of invocation of npm in the docs. I believe that this is currently not possible, right? I suggest to add this functionality though...
This prevents puppet from understanding npm has been installed during the run.
See https://tickets.puppetlabs.com/browse/PUP-5985 for more details.
With ensure => latest
this provider fails with Could not update: Got nil value for ensure
, if the package is already at the latest version.
The culprit is likely this line which fails to set @property_hash[:ensure]
to the actual version of the package.
Nodesource has 0.12 RPMs available for RedHat, but this module doesn't seem to support them. The RPMs are available at: https://rpm.nodesource.com/pub_0.12/el/7/x86_64/
However, the module has the /pup/ directory hard-coded which will always give 0.10. This is supported on Debian. It should be supported on RedHat as well.
We have the default umask set to 0027.
After installing a NPM package via the NPM provider (that is, globally), I had to do a chmod -R a+rX
on /usr/lib/node_modules
first for the module to be accessible by anyone other than root
.
The RSpec tests can't currently be run on TravisCI with sudo: false
as sadly one of the provider tests fail when this is set. Given how slow tests now run on non-docker TravisCI instances, fixing this would without doubt result in an immediate 50% increase in general health and well-being for any PR contributor.
OS: Ubuntu 14.04.2 LTS
Puppet version: 3.7.2-1puppetlabs1
Nodejs module version: 0.8.0
Puppet code snippet:
$npm_packages = [ 'bower','grunt','grunt-cli', ]
package { $npm_packages:
ensure => present,
provider => 'npm',
}
class { 'nodejs':
repo_url_suffix => 'node_0.12',
nodejs_package_ensure => '0.12.7-1nodesource1~trusty1',
before => Package[$npm_packages],
}
Puppet run output:
Info: Retrieving plugin
Info: Caching catalog for REMOVED
Info: Applying configuration version '1443784901'
Notice: /Stage[main]/Nodejs::Repo::Nodesource/Nodejs::Repo::Nodesource::Apt/Apt::Source[nodesource]/Apt::Setting[list-nodesource]/File[/etc/apt/sources.list.d/nodesource.list]/ensure: created
Info: /Stage[main]/Nodejs::Repo::Nodesource/Nodejs::Repo::Nodesource::Apt/Apt::Source[nodesource]/Apt::Setting[list-nodesource]/File[/etc/apt/sources.list.d/nodesource.list]: Scheduling refresh of Class[Apt::Update]
Error: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install nodejs=0.12.7-1nodesource1~trusty1' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 192 not upgraded.
E: Can't find a source to download version '0.12.7-1nodesource1~trusty1' of 'nodejs:amd64'
Wrapped exception:
Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install nodejs=0.12.7-1nodesource1~trusty1' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 192 not upgraded.
E: Can't find a source to download version '0.12.7-1nodesource1~trusty1' of 'nodejs:amd64'
Error: /Stage[main]/Nodejs::Install/Package[nodejs]/ensure: change from absent to 0.12.7-1nodesource1~trusty1 failed: Could not update: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold --force-yes install nodejs=0.12.7-1nodesource1~trusty1' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
The following NEW packages will be installed:
nodejs
0 upgraded, 1 newly installed, 0 to remove and 192 not upgraded.
E: Can't find a source to download version '0.12.7-1nodesource1~trusty1' of 'nodejs:amd64'
Notice: /Stage[main]/Nodejs/Anchor[::nodejs::end]: Dependency Package[nodejs] has failures: true
Warning: /Stage[main]/Nodejs/Anchor[::nodejs::end]: Skipping because of failed dependencies
Notice: /Package[bower]: Dependency Package[nodejs] has failures: true
Warning: /Package[bower]: Skipping because of failed dependencies
Notice: /Package[grunt-cli]: Dependency Package[nodejs] has failures: true
Warning: /Package[grunt-cli]: Skipping because of failed dependencies
Notice: /Package[grunt]: Dependency Package[nodejs] has failures: true
Warning: /Package[grunt]: Skipping because of failed dependencies
Info: Class[Apt::Update]: Scheduling refresh of Exec[apt_update]
Notice: /Stage[main]/Apt::Update/Exec[apt_update]: Triggered 'refresh' from 1 events
Notice: Finished catalog run in 15.63 seconds
The next Puppet run installs node successfully.
In #190, some rspec tests were reformatted to work with Rubocop in a not-so-awesome manner. If we are interested in going back to the previous format, here's the diff required:
$ git diff
diff --git a/spec/defines/nodejs_npm_spec.rb b/spec/defines/nodejs_npm_spec.rb
index 88a93d2..b4e27f2 100644
--- a/spec/defines/nodejs_npm_spec.rb
+++ b/spec/defines/nodejs_npm_spec.rb
@@ -30,8 +30,10 @@ describe 'nodejs::npm', :type => :define do
end
it 'the npm install command should run under user foo' do
- is_expected.to contain_exec('npm_install_express').with('command' => '/usr/bin/npm install express ',
- 'user' => 'foo',)
+ is_expected.to contain_exec('npm_install_express').with(
+ 'command' => '/usr/bin/npm install express ',
+ 'user' => 'foo',
+ )
end
end
On a fresh install of an Ubuntu v14.04 node I come across an issue where Puppet fails to set the global_config_entry because /usr/bin/npm doesn't exist.
Here's my manifest:
class ta_linux::ta_nodejs(
$npm_packages = {},
) {
validate_hash($npm_packages)
$npm_package_defaults = {
'require' => Nodejs::Npm::Global_config_entry['strict-ssl'],
'target' => '/usr/lib',
}
class { '::nodejs':
manage_package_repo => false,
nodejs_dev_package_ensure => present,
npm_package_ensure => present,
}->
nodejs::npm::global_config_entry { 'strict-ssl':
ensure => present,
value => false,
}
create_resources(nodejs::npm, $npm_packages, $npm_package_defaults)
}
When I run my acceptance test for this manifest, it works as expected.
But when I run my acceptance test for another class that loads this ta_linux::ta_nodejs class, it results in this error:
Error: /bin/sh: /usr/bin/npm: No such file or directory
Error: /Stage[main]/Ta_linux::Ta_nodejs/Nodejs::Npm::Global_config_entry[strict-ssl]/Exec[npm_config present strict-ssl]/returns: change from notrun to 0 failed: /bin/sh: /usr/bin/npm: No such file or directory
I have the require relationship between the nodejs class and the global_config_entry define, but that doesn't enforce the installation of npm before trying to set that configuration option.
Obviously, this is pretty obscure and difficult to reproduce (outside of my own environment), but if anyone has any insight here, I'm all ears.
Thanks
Currently this module is without any acceptance tests. It needs some.
I have the following puppet modules:
$ sudo puppet module install puppetlabs-vcsrepo --version 1.3.0
$ sudo puppet module install treydock-gpg_key
$ sudo puppet module install puppetlabs-stdlib --version 4.6.0
$ sudo puppet module install maestrodev-wget --version 1.7.1
$ sudo puppet module install stahnma-epel --version 1.2.2
$ sudo puppet module install puppet-nodejs --version 1.3.0
$ sudo puppet module install puppetlabs-mysql --version 3.6.2
$ sudo puppet module install puppetlabs-concat --version 2.1.0
$ sudo puppet module install puppetlabs-apache --version 1.8.1
$ sudo puppet module install crayfishx-firewalld --version 2.1.0
$ sudo puppet module install willdurand-composer --version 1.1.1
$ sudo puppet module install previousnext-drush --version 0.1.1
Then, I have configure_compilers.pp
:
...
## install nodejs dependencies
class install_nodejs_dependencies {
include stdlib
include wget
}
## install nodejs: to use npm
class install_nodejs {
## set dependency
require install_nodejs_dependencies
class { 'nodejs':
repo_url_suffix => '5.x',
}
}
## install necessary packages
class install_packages {
## set dependency
require install_nodejs_dependencies
require install_nodejs
## variables
$packages_general = ['inotify-tools', 'ruby']
$packages_npm = ['uglify-js', 'node-sass', 'imagemin']
## packages: install general packages (apt, yum)
package { $packages_general:
ensure => 'installed',
before => Package[$packages_npm],
}
## packages: install general packages (npm)
package {$packages_npm:
ensure => 'installed',
provider => 'npm',
}
}
...
## constructor
class constructor {
contain install_nodejs_dependencies
contain install_nodejs
...
}
include constructor
When, I do puppet apply configure_compilers
, I get the following error traceback:
[root@centos7x manifests]# puppet apply configure_compilers.pp
Notice: Compiled catalog for ****.****.****.****.*** in environment production in 1.56 seconds
Notice: /Stage[main]/Nodejs::Install/Package[nodejs]/ensure: created
Error: Command npm is missing
Error: /Stage[main]/Install_packages/Package[uglify-js]/ensure: change from absent to present failed: Command npm is missing
Error: Command npm is missing
Error: /Stage[main]/Install_packages/Package[node-sass]/ensure: change from absent to present failed: Command npm is missing
Error: Command npm is missing
Error: /Stage[main]/Install_packages/Package[imagemin]/ensure: change from absent to present failed: Command npm is missing
...
[root@centos7x manifests]# node -v
v0.10.42
[root@centos7x manifests]# puppet -V
4.3.2
it's time.
The proxy config command fails because it requires Package['npm'] but we don't install this from the managed repo as it's bundled.
I've installed nodejs via:
...
class { 'nodejs':
repo_url_suffix => '5.x',
}
...
But, I'm curious: if I no longer need nodejs after provisioning, and want to remove nodejs entirely, is there an appropriate method to remove it? For example willdurand/puppet-nodejs has the following implementation:
::nodejs::install { 'node-v5.4':
ensure => absent,
version => 'v5.4.1',
}
On Redhat systems, the nodejs::repo::nodesource::yum
class uses a custom gpg_key
resource type. By default, this module is not specified in the dependency list. It appears to be a hard dependency for yum based package managers.
Hey all,
I recently downloaded the nodejs module and I think it's really well done. I have run into a small feature request though. I'm using Ubuntu and the NodeSource packages, which (I believe) puts the npm binary in the same package as nodejs, instead of having 2 separate packages like the base Ubuntu packages.
I would like to be able to use npm to upgrade npm to a specific version. When I set $npm_package_ensure to be a specific version it errors out though because it's trying to install that version via the default provider instead of via the npm provider.
I'd love to add another variable that would allow you to override the provider for npm (something like $npm_provider). Are there any downsides to doing this? Is there a better way to get a specific version of npm using npm? I'd love any feedback that the community would like to share.
Thanx!
If the parameter $repo_url_suffix is provided with 5.x or 4.x the module will ignore it and default to 0.10.x this is due the fact, that in the file "manifests/repo/nodesource.pp" the parameter $source_baseurl is hardcoded to "https://rpm.nodesource.com/pub/". On this route only Node versions up to 0.10.x are provided.
For NodeJs version 5.x the repo ($source_baseurl) should be: "https://rpm.nodesource.com/pub_5.x/" (not just /pub/).
For NodeJs version 4.x the repo ($source_baseurl) should be: "https://rpm.nodesource.com/pub_4.x/" (also not just /pub/).
I'm trying to use nodesource 4.x on CentOS 6.7, which in the version on the forge throws an error. This was fixed in the master branch. Is it possible to get a minor version release so that the fix is available on the forge?
Thanks
nodejs/tests/init.pp fails on my Scientific Linux 6.4 boxes with the following error:
root@sl6:~ # puppet apply /etc/puppet/modules/nodejs/tests/init.pp
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install nodejs-compat-symlinks' returned 1: Error: Cannot retrieve repository metadata (repomd.xml) for repository: nodejs-stable. Please verify its path and try again
Error: /Stage[main]/Nodejs/Package[nodejs]/ensure: change from absent to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install nodejs-compat-symlinks' returned 1: Error: Cannot retrieve repository metadata (repomd.xml) for repository: nodejs-stable. Please verify its path and try again
Error: Execution of '/usr/bin/yum -d 0 -e 0 -y install npm' returned 1: Error: Cannot retrieve repository metadata (repomd.xml) for repository: nodejs-stable. Please verify its path and try again
Error: /Stage[main]/Nodejs/Package[npm]/ensure: change from absent to present failed: Execution of '/usr/bin/yum -d 0 -e 0 -y install npm' returned 1: Error: Cannot retrieve repository metadata (repomd.xml) for repository: nodejs-stable. Please verify its path and try again
This issue arises from the following code in nodejs/manifests/params.pp:
$baseurl = 'http://patches.fedorapeople.org/oldnode/stable/el$releasever/$basearch/'
On RHEL & CentOS, $releasever will return a single digit like '6', and thus the repo above will point to something like http://patches.fedorapeople.org/oldnode/stable/el6/x86_64/ .
However, on Scientific Linux, $releasever is often something like 6x or 6.4:
root@sl6:~ # python -c 'import yum, pprint; yb = yum.YumBase(); pprint.pprint(yb.conf.yumvar, width=1)'
Loaded plugins: fastestmirror, priorities
{'arch': 'ia32e',
'basearch': 'x86_64',
'releasever': '6.4',
'uuid': 'a7d2547c-c95c-4577-88e8-eb0b18c89101'}
Therefore, the URL will turn out to be something like http://patches.fedorapeople.org/oldnode/stable/el6.4/x86_64/, which doesn't exist.
For now, a workaround is to manually modify /etc/puppet/modules/nodejs/manifests/params.pp & replace $releasever with '6', but this only works for a limited number of cases.
I am still familiarizing myself with Puppet and I am unsure how to fix this. However, the commit to puppet-yum (see link [1]) might have a solution. He make use of the $yum::osver & $common::osver variables:
- baseurl => 'http://yum.puppetlabs.com/el/$releasever/dependencies/$basearch',
+ baseurl => "http://yum.puppetlabs.com/el/$common::osver/dependencies/\$basearch",
manifests:
class {'nodejs':
manage_repo => true,
}
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install nodejs' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nodejs : Depends: libc6 (>= 2.14) but 2.13-38 is to be installed
Depends: libv8-3.14.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Error: /Stage[main]/Nodejs/Package[nodejs]/ensure: change from purged to present failed: Execution
of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install nodejs' returned 100: Reading
package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
nodejs : Depends: libc6 (>= 2.14) but 2.13-38 is to be installed
Depends: libv8-3.14.5 but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install npm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
npm : Depends: nodejs but it is not going to be installed
Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
Depends: node-ansi but it is not going to be installed
Depends: node-archy but it is not going to be installed
Depends: node-block-stream but it is not going to be installed
Depends: node-fstream (>= 0.1.22) but it is not going to be installed
Depends: node-fstream-ignore but it is not going to be installed
Depends: node-github-url-from-git but it is not going to be installed
Depends: node-glob (>= 3.1.21) but it is not going to be installed
Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
Depends: node-inherits but it is not going to be installed
Depends: node-ini (>= 1.1.0) but it is not going to be installed
Depends: node-lockfile but it is not going to be installed
Depends: node-lru-cache (>= 2.3.0) but it is not going to be installed
Depends: node-minimatch (>= 0.2.11) but it is not going to be installed
Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
Depends: node-gyp (>= 0.10.9) but it is not going to be installed
Depends: node-nopt (>= 2.1.1) but it is not going to be installed
Depends: node-npmlog but it is not going to be installed
Depends: node-once but it is not going to be installed
Depends: node-osenv but it is not going to be installed
Depends: node-read but it is not going to be installed
Depends: node-read-package-json (>= 1.1.0) but it is not going to be installed
Depends: node-request (>= 2.25.0) but it is not going to be installed
Depends: node-retry but it is not going to be installed
Depends: node-rimraf (>= 2.2.2) but it is not going to be installed
Depends: node-semver (>= 2.1.0) but it is not going to be installed
Depends: node-sha but it is not going to be installed
Depends: node-slide but it is not going to be installed
Depends: node-tar (>= 0.1.18) but it is not going to be installed
Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
Error: /Stage[main]/Nodejs/Package[npm]/ensure: change from purged to present failed: Execution of
'/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install npm' returned 100: Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:
The following packages have unmet dependencies:
npm : Depends: nodejs but it is not going to be installed
Depends: node-abbrev (>= 1.0.4) but it is not going to be installed
Depends: node-ansi but it is not going to be installed
Depends: node-archy but it is not going to be installed
Depends: node-block-stream but it is not going to be installed
Depends: node-fstream (>= 0.1.22) but it is not going to be installed
Depends: node-fstream-ignore but it is not going to be installed
Depends: node-github-url-from-git but it is not going to be installed
Depends: node-glob (>= 3.1.21) but it is not going to be installed
Depends: node-graceful-fs (>= 2.0.0) but it is not going to be installed
Depends: node-inherits but it is not going to be installed
Depends: node-ini (>= 1.1.0) but it is not going to be installed
Depends: node-lockfile but it is not going to be installed
Depends: node-lru-cache (>= 2.3.0) but it is not going to be installed
Depends: node-minimatch (>= 0.2.11) but it is not going to be installed
Depends: node-mkdirp (>= 0.3.3) but it is not going to be installed
Depends: node-gyp (>= 0.10.9) but it is not going to be installed
Depends: node-nopt (>= 2.1.1) but it is not going to be installed
Depends: node-npmlog but it is not going to be installed
Depends: node-once but it is not going to be installed
Depends: node-osenv but it is not going to be installed
Depends: node-read but it is not going to be installed
Depends: node-read-package-json (>= 1.1.0) but it is not going to be installed
Depends: node-request (>= 2.25.0) but it is not going to be installed
Depends: node-retry but it is not going to be installed
Depends: node-rimraf (>= 2.2.2) but it is not going to be installed
Depends: node-semver (>= 2.1.0) but it is not going to be installed
Depends: node-sha but it is not going to be installed
Depends: node-slide but it is not going to be installed
Depends: node-tar (>= 0.1.18) but it is not going to be installed
Depends: node-which but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
One of the provider tests uses a deprecated should
form in its RSpec test. This should be replaced with the supported equivalent.
Using `should` from rspec-expectations' old `:should` syntax without explicitly enabling the syntax is deprecated.
Use the new `:expect` syntax or explicitly enable `:should` instead.
Called from ../puppet-nodejs/spec/unit/puppet/provider/package/npm_spec.rb:18:in `block (2 levels) in it_should_respond_to'.
Just changing the repo_url_suffix
from node_4.x
to node_5.x
and set ensure to present
or latest
doesn't do any changes.
Version 4.x will still be installed, since it fulfills the present
requirement.
A way to force a new version is to set a certain version.
For an upgrade:
class { 'nodejs':
manage_package_repo => true,
repo_url_suffix => 'node_5.x',
nodejs_package_ensure => '5.4.0-1nodesource1~wheezy1' # or latest
}
latest
does not work for a downgrade though, so for a downgrade you have to do something like this:
class { 'nodejs':
manage_package_repo => true,
repo_url_suffix => 'node_4.x',
nodejs_package_ensure => '4.2.4-1nodesource1~wheezy1'
}
Sadly, the apt.pp file only updates the sources if the nodejs_package_ensure is set to present
11: if ($ensure == 'present') {
Maybe I got it all wrong and there's another way to upgrade/downgrade major versions. Otherwise I'd write a PR.
So I propose a change
11: if ($ensure != 'absent') {
I experienced a problem today when provisioning a Debian Wheezy VM. Node.js and NPM would both install, but the two modules I used with them, buster and sinon, did not. Invocations of either binary would yield an error. It seemed that both relied on the node
binary being available, which is not the case with the nodejs
package in Debian. However, when the Debian team decided to rename to package, it added an additional package. That package is nodejs-legacy
0. The package provides both the node
and nodejs
binaries, thereby providing both options to modules and developers alike.
It looks like package nodejs-compat-symlinks
from http://patches.fedorapeople.org/oldnode/ wants to create /usr/bin/node
and /usr/include/node
which appear to be provided by a new EPEL nodejs
package (added in April?).
I wonder if the EPEL packages might be better to rely on for RHEL5/6 compatibility? I am using http://forge.puppetlabs.com/stahnma/epel on all of my nodes since it provides many RPMs I rely on.
when installing a module from git
nodejs::npm { 'node-wimoto':
ensure => 'present',
package => 'node-wimoto',
source => 'onzyone/node-wimoto',
target => '/opt/packages',
}
source ends up in the grep as source is no longer registry
if $source != 'registry' {
$install_check_package_string = $source
$package_string = $source
this fails and re installs the module over and over again as it is looking for
Debug: Exec[npm_install_node-wimoto](provider=posix): Executing check '/usr/bin/npm ls --long --parseable | grep "/opt/packages/node_modules/onzyone/node-wimoto"'
Debug: Executing: '/usr/bin/npm ls --long --parseable | grep "/opt/packages/node_modules/onzyone/node-wimoto"'
and not
grep "/opt/packages/node_modules/node-wimoto"'
Whenever I attempt to use the nodejs module in the following way:
class {
'nodejs':
repo_url_suffix => 'node_0.12',
legacy_debian_symlinks => true;
}
The error "undefined method `ref' for nil:NilClass" comes up. This only happens when including this module, I have attempted just about everything given that I cannot get a decent stack trace that actually tells me boo of what is happening. Basically the puppetmaster refuses to supply it because of this.
/etc/puppet/environments/production/modules
├── puppet-nodejs (v1.1.0)
├── puppetlabs-apache (v1.0.1)
├── puppetlabs-apt (v2.1.0)
├── puppetlabs-concat (v1.2.3)
├── puppetlabs-firewall (v1.6.0)
├── puppetlabs-mysql (v2.2.3)
├── puppetlabs-ntp (v4.0.0)
├── puppetlabs-stdlib (v4.6.0)
├── saz-timezone (v3.0.1)
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.2 LTS"
Puppet version: 3.8.1
Puppetmaster version: 3.8.1
If ready, update metadata.json
Every release after 0.8.0 is missing on Puppet forge. Can you have a look here and ensure all newer releases are available?
After upgrading my environment to use v2.0.0, a node on CentOS 6.6 receives the following errors:
Could not autoload puppet/provider/package/npm: /var/lib/puppet/lib/puppet/provider/package/npm.rb:3: syntax error, unexpected ':', expecting $end ...package).provide :npm, parent: Puppet::Provider::Package do ^
Could not retrieve local facts: Could not autoload puppet/provider/package/npm: /var/lib/puppet/lib/puppet/provider/package/npm.rb:3: syntax error, unexpected ':', expecting $end ...package).provide :npm, parent: Puppet::Provider::Package do ^
Failed to apply catalog: Could not retrieve local facts: Could not autoload puppet/provider/package/npm: /var/lib/puppet/lib/puppet/provider/package/npm.rb:3: syntax error, unexpected ':', expecting $end ...package).provide :npm, parent: Puppet::Provider::Package do ^
Another node in my environment is on CentOS 7.2 and didn't receive this error.
Hey, would it be possible to push a new version to the Forge? the one there is too old and there are plenty of bugfixes in git
Thanks
A package with provider => npm may run before npm is installed and fail
Not sure if it is ok to add it in the module, but at least should be in the README
if $::operatingsystem != 'ubuntu' {
Package['npm'] -> Package <| provider == npm |>
} else {
Package['nodejs'] -> Package <| provider == npm |>
}
An nodejs::npm anchor would also simplify the rule above
Does it look reasonable?
Using the nodejs::npm type I have the following experience. When setting ensure => latest on a package that is not installed, I get the following error:
package { 'express':
ensure => 'latest',
provider => 'npm',
}
Error: Could not update: Got nil value for ensure
Error: /Stage[main]/Main/Package[express]/ensure: change from absent to latest failed: Could not update: Got nil value for ensure
Changing to:
package { 'express':
ensure => 'present',
provider => 'npm',
}
I can then successfully install it. Then changing it to latest and running again works.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.