Vagrant + chef-solo + berkshelf: node.js last version cookbook - node.js

Basically, i need a working machine with node.js & npm installed.
I've configured a vagrant + berkshelf + chef enviroment, but i can't find a lastest version (>= 4.0.0) nodejs cookbook as source for my berksfile.
I've tried with this:
https://supermarket.chef.io/cookbooks/nodejs
from chef supermarket but install a old version of node + npm.
I am experiencing for the first time vagrant and chef so i can't understand how find it.
Can someone help me?

In your role or node settings you can specify default attributes for any cookbook you use. Cookbook nodejs allows you to set NodeJS version with the attribute version (check its attributes/default.rb file). But this attribute is taken into account only when NodeJS is installed from precompiled binaries or sources. So you need to specify install_method as well (default is package, i.e. installation via system package manager).
One more thing: you need to manually specify binary package checksum, which you can find in every release folder here: https://nodejs.org/download/release/
So, to install the latest version from official binaries use the following settings in role or node:
"nodejs": {
"install_method": "binary",
"binary": {
"checksum": "75b029b30d4a4147d67cf75bf6e034291fb5919c6935ec23f8365cee2d463f12"
},
"version": "5.3.0"
}

Related

Cannot update the AWS-SDK package in node.js

To this make easier I created a fresh node.js application on VS code. The only package/dependency I install is AWS-SDK. in my package.json the version is shown as "aws-sdk": "^2.1314.0",
as far as I am aware the most recent version is 3.270.0. my node.js version is v14.18.1.
I have manually edited pakage.json to reflect the new version then done npm install aws-sdk again, doesnt work. sometimes it reverts back to 2.1314.0, sometimes the version I added remains but npm aws-sdk list command still shows old version
Hope this is enough information! Thanks
First of all stop using version 2 of aws sdk as it is planned to go into maintenance mode from 2023
Second from version 3, you only use you load and use only the individual AWS Services you need to save the the size of code.
if you need to use only a few AWS services, it means increasing the size of your application with code you don't need or use.
For example to use fynamodb package in version 3 you will use use
npm i #aws-sdk/client-s3
Coming to your question
delete node modules directory
npm cache clean --force
just simple remove the entry in your package.json and add entry like this
"dependencies": {
"#aws-sdk/client-s3": "^3.256.0"
}
npm i #aws-sdk/client-s3
For reference on aws sdk v3 - https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/welcome.html

Domino10 appDevPack: "Error: Cannot find module '#domino/domino-db'"

Just installed the latest Domino 10.0.1 Server on my linux machine and also installed and configured the latest proton package. As far as I can tell it's all running fine.
Next I plan to try my first Node-RED flow using the new Domino10 nodes. So I installed the 'node-red-contrib-dominodb' palette.
Finally tried my first very simple flow trying to query node-demo.nsf as it's described here. From what I read there I assumed that it's sufficient to install the palette, but that obviously is not the case:
as soon as I hit 'Deploy' I receive this error:
Error: Cannot find module '#domino/domino-db'
So I thought that I maybe still have to do a global install in node.js using
npm install -g <package-path>/domino-domino-db-1.1.0.tgz
This indeed created a local #domino/domino-db module inside my node.js npm\node_modules folder. But obviously my node-red environment doesn't know about it.
Question is: how do I register / install that npm package for my local node-red environment?
IBM's instructions (https://flows.nodered.org/node/node-red-contrib-dominodb#Installation)
Say to go view this guide(https://github.com/stefanopog/node-red-contrib-dominodb/blob/master/docs/Using%20the%20new%20Domino%20V10%20NodeRED%20nodes%202.pdf) for installing the domino-db module.
The link is broken, here's an old copy: https://github.com/stefanopog/node-red-contrib-dominodb/blob/a723ef88498c5bfa243abd956a7cc697f0a42610/docs/Using%20the%20new%20Domino%20V10%20NodeRED%20nodes%202.pdf
I believe the section you want is called "Import the tarball". The steps before that require you to unpack and then re-pack the module... which is unnecessary. Just use the tgz that was in the AppDev Pack to begin with.

Azure's node Deploy uses wrong Node and NPM

When I deploy to Azure WebSite the node runtime correctly uses the Nodejs I config in package.json, however the deployment script uses the node and NPM on the server's path. (The Server path is messed up and has both node version in the path.)
Ex. I want nodejs 4.2.1 and NPM >2
When I deploy an app it uses 0.10.x and NPM 1.x.x. My rxjs module requires NPM > 2 so it fails to load.
If I deploy avoiding the packages I can see the correct runtime is run.
Is there a way to fix this issue?
You can simply customize the nodejs version in Azure manage portal.
In CONFIGUE tab of your web site portal, under the APP SETTINGS section, the nodejs version is set as WEBSITE_NODE_DEFAULT_VERSION to 0.10.32 by Azure default, we can directly change it value to 4.2.1 you want.
Click the restart button at bottom nav bar after you modified the site setting.
Login on your KUDU console site, you can check the nodejs version in the cmdlet.(The site URL should be: https://{your site name}.scm.azurewebsites.net/DebugConsole)
And the nodejs version is 4.2.1 with npm version 3.3.9 after modification.
You can get more info at Specifying a Node.js version in an Azure application.
There are also atleast two other mentions on various sources claiming that it can be set via package.js:
"engines": {
"node": ">= 8.2.0 || 8.x.x",
"npm": ">= 5.3.0 || 5.x.x"
},
Or via the iisnode.yaml file in the site directory root. Which one does the trick is really hard to discover since you can only tell the node version correctly during runtime of the app.

Unable to install nodejs on my computer

I am using windows and when I took reference to download node js from here. When I write this line
C:> cinst nodejs.install -Version 0.6.10
in CMD it gives an error
C:>cinst nodejs.install -Version 0.6.10
'cinst' is not recognized as an internal or external command,
operable program or batch file.
I don't know how to install node js.I also have a question that if I install node js version say v0.10.26 will the programs made with previous versions(say 0.9) will work on 0.10
That error means that your cmd session can't find cinst. To use cinst, you have to install the package manager from http://chocolatey.org/
If you just want to get Node.js running though, there's a Windows installer at http://nodejs.org/download/ or you can just hit the big green Install button at http://nodejs.org/
Summarizing comments:
All of the versions are maintained and available under http://nodejs.org/dist/, 0.6.10 can be found at: http://nodejs.org/dist/v0.6.10/ and you can get the Windows installer by downloading the .msi file.
As for whether there might be breaking changes from version to version, most code moves forward just fine, but testing is always a good idea. Some packages will specify a specific version in their package.json file, but most will just request a version greater than a certain point in the engines element like:
{ "engines" : { "node" : ">=0.6.10" } }

Installing MongoDb with Puppet

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.

Resources