I'm trying to install newest version of nodejs on Ubuntu by Puppet.
In my Puppet defualt.pp I include nodejs module from Puppet Forge.
I need to change variable $manage_repo in nodejs module to true (it manages to download last version of nodejs package from Chris Lea's repo). But $nodejs::manage_repo = true fails with error "Cannot assign to variables in other namespaces" (yes I understand this).
Can you help me, how to set this variable of module from my default.pp?
Thanks a lot!
Ha! I found solution few minutes after sending this question .. as always:)
If you want to set variables in module you can't include module class by include module, but include module like this:
class {'module': variable => 'value', }
Carefully read doc here: http://docs.puppetlabs.com/learning/modules2.html (i was blind previous, or what?..)
Related
I'm pretty new with NodeJS and I'm trying to use a module called "updated-node-msmq" (from this repository) in my project but getting an error.
What I've done:
I opened a new folder for the project.
I used the command "$ npm install --save updated-node-msmq" and got some warnings (Screenshot attached).
When I try to use the module according to the README, and run my "test.js" file I got the following error here in the screenshot).
I am using version 14.16.0 of NodeJS and after trying to fix this myself I realized that probably the problem is that the module was built for older versions of NodeJS.
I understand that low version is not a recommended solution, but I have no clue how to update a module.
Help / guidance in solving the problem?
Thanks in advance everyone!
Why are you using updated-node-msmq? That package seems like a mess, and the errors you are getting is because the whole module is written with ES2015 but doesn't seem to have been transpiled to node.js compatible code before published to NPM.
I'd advise you to use a tried and tested module for MSMQ first and foremost.
EDIT: Seems like the author fucked up in the 0.2.0 version. You could use the 0.1.9 (by instead using npm install updated-node-msmq#0.1.9 but that one is 3 years old.
Im trying to follow this official guide on how to do internationalization in react-admin. I install the language pack using npm install aor-language-swedish, and change from aor to ra in index.js of aor-language-swedish in order to make it work it react-admin instead of admin on REST (I have also tried the English pack whcih is natively supported in react-admin, but I get the same error described below).
I then try to do
import swedishMessages from "aor-language-swedish";
in my App.js but upon hovering the import, i get the error:
Could not find a declaration file for module 'aor-language-swedish'.
'c:/Users/ssm/Documents/Visual Studio Code/adminui/node_modules/aor-
language-swedish/index.js' implicitly has an 'any' type.
Try `npm install #types/aor-language-swedish` if it exists or add a new
declaration (.d.ts) file containing `declare module 'aor-language-
swedish';
What could be causing this error? I have looked around the internet, but to no avail.
If you're getting this error it is probably because you're using TypeScript, have you tried to run npm install --save-dev #types/aor-language-swedish ?
If this doesn't exist you will have to manually add a typing file, you can follow the following tutorial in order to do so:
https://medium.com/#chris_72272/migrating-to-typescript-write-a-declaration-file-for-a-third-party-npm-module-b1f75808ed2
It turns out that this problem was not in fact a problem. Ignoring it seems to work, and remember to change the root key in index.js of the package to ra instead of aor if you are using an older react-admin language module (like Swedish). However, it would be interesting to know why this warning is shown, as I am not using TypeScript. Might it be an extension that is causing this warning?
I'd like to use vcsrepo module in my puppet module manifest. So I need to install puppetlabs/vcsrepo.
Is it possible to avoid installing it manualy by command
sudo puppet install puppetlabs-vcsrepo?
I've tried to use somethink like this in my init.pp file
module { 'puppetlabs/vcsrepo':
ensure => installed,
}
but it doesn't work :(
The best way to use that module would be to add it to your metadata.json file as explained here: https://docs.puppetlabs.com/guides/style_guide.html#module-metadata
Once you've done so the module requested, in your case puppetlabs/vcsrepo will be installed.
I'm trying to figure out how to use external javascript libraries in the Atom editor. I used npm to install the momentjs library, since Atom uses node. However, I'm puzzled as to what to do now? I can't find a way to use the library in Atom.
I thought that I could go to the Atom init.coffee file and do a require "moment" (also tried require "momentjs") but nothing seems to work.
The whole reason behind this is so I can use some javascript libraries for formatting dates in a snippet (I have another SO question about that which I'll close if this solves it).
But this question is a general question about installing and running javascript libraries in Atom. I've looked through the Atom docs and Googled, but I can't find a good answer. I figured something like this would be pretty easy?
As Atom bundle its own node version (and thus is not using your global version(s)) it won't load globally installed modules through require.
However, the require method supporting absolute paths, you can still load any module if you know it's absolute path, which shouldn't be a problem in your specific case.
In your init script you can write:
momentjs = require('/path/to/momentjs')
But beware of modules that ships with binaries. Atom is using node 0.11.13 so if the module you're trying to require have been installed for a different version you'll get a Error: Module did not self-register.. In that case I'm afraid the only solution would be to install the module as a dependency of an Atom package (as suggested by #nwinkler).
You should be able to do the following when developing your own package:
Install moment using npm install --save moment - this will install the moment.js library as a dependency and register it in the package.json file
In your library, import it in your lib file:
moment = require 'moment';
myDate = moment().format();
Then you can use the moment object to format your timestamps.
All of this will only work if you're doing your own package, of course. Not sure if this will work with simple snippets as well.
I'm a newbie in Puppet, so maybe you'll find my question a bit stupid...
So, I'm looking for puppet recipe that will install and run Mongodb 2.2 on my machine. By googling I found this module http://forge.puppetlabs.com/puppetlabs/mongodb But I didn't understand clear what should I do?
It said I have to install module on puppet node first. What does exactly it means?
Let's say, I have a set of machines those must be configured via puppet.
What do I have to add to puppet recipe to reach this aim?
In case someone might be interest on installing the last version of MongoDB this worked very well for me. At the moment of writing the latest stable version is MongoDB 3.0.3.
First of all update your OS repositories via the puppet apt module (in case you're using a Debian or Ubuntu distribution). Change the data below according to your distribution and version. Check here to get the MongoDB official repositories information: http://docs.mongodb.org/manual/administration/install-on-linux/#recommended
# $::lsbdistcodename should contain what you usually get
# with the `lsb_release -sc` command
$server_lsbdistcodename = downcase($::lsbdistcodename)
apt::source { 'mongodb-org-3.0':
location => 'http://repo.mongodb.org/apt/debian',
release => "${server_lsbdistcodename}/mongodb-org/3.0",
repos => 'main',
key => '7F0CEB10',
key_server => 'keyserver.ubuntu.com',
include_src => false
}
And then set the mongodb::globals class properly to make sure you get MongoDB 3. The MongoDB puppet module I'm using is this one.
class { 'mongodb::globals':
manage_package_repo => false, # disable the 10gen repository
server_package_name => 'mongodb-org',
service_name => 'mongod',
version => '3.0.3',
}->
class { '::mongodb::server': }
Getting mongodb installed with puppet isn't as easy as it seems. It's somewhat difficult to get official Puppet Labs module v0.8.0 to install mongodb 2.6.3. You end up getting an apt error about mongodb-10gen=2.6.3 not being found. There's an issue and a patch already but it hasn't been published yet.
So here's what you need to do:
git clone https://github.com/puppetlabs/puppetlabs-mongodb.git
Then use the following puppet config:
class { '::mongodb::globals':
manage_package_repo => true,
server_package_name => 'mongodb-org',
version => '2.6.3'
}->
class { '::mongodb::server': }
This Worked for me.
If you are running puppet standalone, you will have already installed the puppet gem and have the puppet executable. To intall the module, you run puppet module install puppetlabs/mongodb. After the module installation, you can simply include the mongodb module in your node definition
node 'myhost' {
include mongodb
}
If you want to run a number of nodes that need access to the module, you'll have to setup a puppetmaster and install the node. See [Basic Agent/Master setup][1] for more info. Make sure that pluginsync=true is enabled in puppet.conf so the module can make it's way to the remote agents.
The puppetmaster will then need a file, normally site.pp defined with the nodes it should configure. Finally, include the mongodb module on each node you want to run mongodb and you should be up and running.