{"id":15013928,"url":"https://github.com/voxpupuli/puppet-nodejs","last_synced_at":"2025-04-10T23:26:55.101Z","repository":{"id":2932678,"uuid":"3944274","full_name":"voxpupuli/puppet-nodejs","owner":"voxpupuli","description":"Puppet module to install nodejs and global npm packages","archived":false,"fork":false,"pushed_at":"2025-03-19T19:10:04.000Z","size":807,"stargazers_count":113,"open_issues_count":25,"forks_count":244,"subscribers_count":112,"default_branch":"master","last_synced_at":"2025-04-05T21:05:00.530Z","etag":null,"topics":["bsd-puppet-module","centos-puppet-module","debian-puppet-module","freebsd-puppet-module","hacktoberfest","linux-puppet-module","oraclelinux-puppet-module","puppet","redhat-puppet-module","scientific-puppet-module","ubuntu-puppet-module"],"latest_commit_sha":null,"homepage":"https://forge.puppet.com/puppet/nodejs","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/voxpupuli.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"open_collective":"vox-pupuli","github":"voxpupuli"}},"created_at":"2012-04-05T21:19:54.000Z","updated_at":"2024-07-09T21:16:09.000Z","dependencies_parsed_at":"2024-11-06T08:34:03.669Z","dependency_job_id":"5121d5b9-d849-43ff-bc4d-ecff56d9571c","html_url":"https://github.com/voxpupuli/puppet-nodejs","commit_stats":{"total_commits":428,"total_committers":105,"mean_commits":4.076190476190476,"dds":0.7149532710280374,"last_synced_commit":"fc5cc7576cd4fdff60f4c8b2c47b6fbdbd015bd8"},"previous_names":["puppetlabs/puppetlabs-nodejs"],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-nodejs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-nodejs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-nodejs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/voxpupuli%2Fpuppet-nodejs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/voxpupuli","download_url":"https://codeload.github.com/voxpupuli/puppet-nodejs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248279196,"owners_count":21077406,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bsd-puppet-module","centos-puppet-module","debian-puppet-module","freebsd-puppet-module","hacktoberfest","linux-puppet-module","oraclelinux-puppet-module","puppet","redhat-puppet-module","scientific-puppet-module","ubuntu-puppet-module"],"created_at":"2024-09-24T19:44:57.615Z","updated_at":"2025-04-10T23:26:55.069Z","avatar_url":"https://github.com/voxpupuli.png","language":"Ruby","funding_links":["https://opencollective.com/vox-pupuli","https://github.com/sponsors/voxpupuli"],"categories":[],"sub_categories":[],"readme":"# Node.js module for Puppet\n\n[![Build Status](https://travis-ci.org/voxpupuli/puppet-nodejs.png?branch=master)](https://travis-ci.org/voxpupuli/puppet-nodejs)\n[![Code Coverage](https://coveralls.io/repos/github/voxpupuli/puppet-nodejs/badge.svg?branch=master)](https://coveralls.io/github/voxpupuli/puppet-nodejs)\n[![Puppet Forge](https://img.shields.io/puppetforge/v/puppet/nodejs.svg)](https://forge.puppetlabs.com/puppet/nodejs)\n[![Puppet Forge - downloads](https://img.shields.io/puppetforge/dt/puppet/nodejs.svg)](https://forge.puppetlabs.com/puppet/nodejs)\n[![Puppet Forge - endorsement](https://img.shields.io/puppetforge/e/puppet/nodejs.svg)](https://forge.puppetlabs.com/puppet/nodejs)\n[![Puppet Forge - scores](https://img.shields.io/puppetforge/f/puppet/nodejs.svg)](https://forge.puppetlabs.com/puppet/nodejs)\n\n## Table of Contents\n\n1. [Overview](#overview)\n1. [Setup - The basics of getting started with nodejs](#setup)\n    * [Beginning with nodejs - Installation](#beginning-with-nodejs)\n1. [Usage](#usage)\n1. [Npm packages](#npm-packages)\n1. [Limitations - OS compatibility, etc.](#limitations)\n    * [Module dependencies](#module-dependencies)\n1. [Development](#development)\n\n## Overview\n\nThe nodejs module installs the Node.js package, (global) npm package provider\nand configures global npm configuration settings. A defined type nodejs::npm\nis used for the local installation of npm packages.\n\nBy default this module installs packages from the [NodeSource](https://nodesource.com)\nrepository on Debian and RedHat platforms. The NodeSource Node.js package\nincludes the npm binary, which makes a separate npm package unnecessary.\n\nOn SUSE, ArchLinux, FreeBSD, OpenBSD and Gentoo, native packages are used. On\nDarwin, the MacPorts package is used. On Windows the packages are installed\nvia Chocolatey.\n\n## Setup\n\n### What nodejs affects\n\n* the Node.js package\n* the npm package (if it exists as a separate package)\n* the global npmrc file ($PREFIX/etc/npmrc)\n* globally installed npm packages\n* local npm packages installed in user-specified directories\n\n### Beginning with nodejs\n\nTo install Node.js and npm (using the NodeSource repository if possible):\n\n```puppet\nclass { 'nodejs': }\n```\n\nThe default version installed is currently `20.x`.\n\nIf you wish to install a Node.js 21.x release from the NodeSource repository\nrather than 20.x on Debian/RHEL platforms:\n\n```puppet\nclass { 'nodejs':\n  repo_version =\u003e '21',\n}\n```\n\nSee the `repo_version` parameter entry below for possible values.\n\n## Usage\n\nWhen a separate npm package exists (natively or via EPEL) the Node.js development\npackage also needs to be installed as it is a dependency for npm.\n\nInstall Node.js and npm using the native packages provided by the distribution:\n\n```puppet\nclass { 'nodejs':\n  manage_package_repo       =\u003e false,\n  nodejs_dev_package_ensure =\u003e installed,\n  npm_package_ensure        =\u003e installed,\n}\n```\n\nInstall Node.js and npm using the packages from EPEL:\n\n```puppet\nclass { 'nodejs':\n  nodejs_dev_package_ensure =\u003e installed,\n  npm_package_ensure        =\u003e installed,\n  repo_class                =\u003e 'epel',\n}\n```\n\n### Upgrades\n\nThe parameter `nodejs_package_ensure` defaults to `installed`. Changing the\n`repo_version` will not result in a new version being installed. Changing\nthe `nodejs_package_ensure` parameter should provide the desired effect.\n\nFor example:\n\n```puppet\n# Upgrade from nodejs 5.x to 6.x\nclass { 'nodejs':\n  repo_version          =\u003e '6',\n  nodejs_package_ensure =\u003e '6.12.2',\n}\n```\n\n### Forcing the installation of NodeSource packages over native packages\n\nWhen the native package version and NodeSource version are the same, you may\nneed to use `repo_pin` or `repo_priority` (depending on your operating system).\nThis ensures that the version in the NodeSource repository takes precedence\nwhen Puppet invokes Apt/Yum.\n\n### npm packages\n\nTwo types of npm packages are supported:\n\n* npm global packages are supported via the `npm` provider for the puppet\n  package type.\n* npm local packages are supported via the Puppet defined type nodejs::npm.\n\nFor more information regarding global vs local installation see the [nodejs blog](https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/)\n\n### npm global packages\n\nThe npm package provider is an extension of the Puppet package type which\nsupports versionable and upgradeable. The package provider only handles global\ninstallation:\n\nFor example:\n\n```puppet\npackage { 'express':\n  ensure   =\u003e installed,\n  provider =\u003e 'npm',\n}\n\npackage { 'mime':\n  ensure   =\u003e '1.2.4',\n  provider =\u003e 'npm',\n}\n```\n\n### npm local packages\n\nnodejs::npm is used for the local installation of npm packages. It attempts to\nsupport all of the `npm install \u003cpackage\u003e` combinations shown in the\n[npm install docs](https://docs.npmjs.com/cli/install)\nexcept version ranges. The title simply must be a unique, arbitrary value.\n\n* If using packages directly off the npm registry, the package parameter is the\n  name of the package as published on the npm registry.\n* If using scopes, the package parameter needs to be specified as\n  '@scope_name/package_name'.\n* If using a local tarball path, remote tarball URL, local folder, git remote\n  URL or GitHubUser/GitRepo as the source of the package, this location needs\n  to be specified as the source parameter and the package parameter just needs\n  to be a unique, descriptive name for the package that is being installed.\n* If using tags, the tag can be specified with the ensure parameter, and\n  the package parameter needs to be match the name of the package in the npm\n  registry.\n* Package versions are specified with the ensure parameter, which defaults to\n  `installed`.\n* Install options and uninstall options are also supported, and need to be\n  specified as an array.\n* The user parameter is provided should you wish to run npm install or npm rm\n  as a specific user.\n* If you want to use a package.json supplied by a module to install dependencies\n  (e.g. if you have a NodeJS server app), set the parameter use_package_json to true.\n  The package name is then only used for the resource name. source parameter is ignored.\n\nExamples:\n\nInstall the express package published on the npm registry to /opt/packages:\n\n```puppet\nnodejs::npm { 'express from the npm registry':\n  ensure  =\u003e 'present',\n  package =\u003e 'express',\n  target  =\u003e '/opt/packages',\n}\n```\n\nor the lazy way:\n\n```puppet\nnodejs::npm { 'express':\n  target  =\u003e '/opt/packages',\n}\n```\n\nInstall the express package as user foo:\n\n```puppet\nnodejs::npm { 'express install as user foo':\n  ensure  =\u003e 'present',\n  package =\u003e 'express',\n  target  =\u003e '/opt/packages',\n  user    =\u003e 'foo',\n}\n```\n\nInstall a specific version of express to /opt/packages:\n\n```puppet\nnodejs::npm { 'express version 2.5.9 from the npm registry':\n  ensure  =\u003e '2.5.9',\n  package =\u003e 'express',\n  target  =\u003e '/opt/packages',\n}\n```\n\nInstall the latest version of express to /opt/packages:\n\n```puppet\nnodejs::npm { 'express latest from the npm registry':\n  ensure  =\u003e 'latest',\n  package =\u003e 'express',\n  target  =\u003e '/opt/packages',\n}\n```\n\nInstall express from GitHub to /opt/packages:\n\n```puppet\nnodejs::npm { 'express from GitHub':\n  ensure  =\u003e 'present',\n  package =\u003e 'express',\n  source  =\u003e 'strongloop/express',\n  target  =\u003e '/opt/packages',\n}\n```\n\nInstall express from a remote git repository to /opt/packages:\n\n```puppet\nnodejs::npm { 'express from a git repository':\n  ensure  =\u003e 'present',\n  package =\u003e 'express',\n  source  =\u003e 'git+https://git@github.com/strongloop/expressjs.git',\n  target  =\u003e '/opt/packages',\n}\n```\n\nInstall express from a remote tarball to /opt/packages:\n\n```puppet\nnodejs::npm { 'express from a remote tarball':\n  ensure  =\u003e 'present',\n  package =\u003e 'express',\n  source  =\u003e 'https://server.domain/express.tgz',\n  target  =\u003e '/opt/packages',\n}\n```\n\nInstall tagged packages:\n\n```puppet\nnodejs::npm { 'my beta tagged package':\n  ensure  =\u003e 'beta',\n  package =\u003e 'mypackage',\n  target  =\u003e '/opt/packages',\n}\n```\n\nInstall a package from the registry associated with a specific scope:\n\n```puppet\nnodejs::npm { 'package_name from @scope_name':\n  ensure  =\u003e 'present',\n  package =\u003e '@scope_name/package_name',\n  target  =\u003e '/opt/packages',\n}\n```\n\nInstall express from a local tarball to /opt/packages:\n\n```puppet\nnodejs::npm { 'express from a local tarball':\n  ensure  =\u003e 'present',\n  package =\u003e 'express',\n  source  =\u003e '/local/repository/npm_packages/express.tgz',\n  target  =\u003e '/opt/packages',\n}\n```\n\nInstall express with --save-dev --no-bin-links passed to `npm install`:\n\n```puppet\nnodejs::npm { 'express with options':\n  ensure          =\u003e 'present',\n  package         =\u003e 'express',\n  install_options =\u003e ['--save-dev', '--no-bin-links'],\n  target          =\u003e '/opt/packages',\n}\n```\n\nInstall dependencies from package.json:\n\n```puppet\nnodejs::npm { 'serverapp':\n  ensure           =\u003e 'present',\n  target           =\u003e '/opt/serverapp',\n  use_package_json =\u003e true,\n}\n```\n\nUninstall any versions of express in /opt/packages regardless of source:\n\n```puppet\nnodejs::npm { 'remove all express packages':\n  ensure  =\u003e 'absent',\n  package =\u003e 'express',\n  target  =\u003e '/opt/packages',\n}\n```\n\nUninstall dependencies from package.json:\n\n```puppet\nnodejs::npm { 'serverapp':\n  ensure           =\u003e 'absent',\n  target           =\u003e '/opt/serverapp',\n  use_package_json =\u003e true,\n}\n```\n\n### nodejs::npm::global_config_entry\n\nnodejs::npm::global_config_entry can be used to set/remove global npm\nconfiguration settings.\n\nNote that when specifying a URL, such as registry, NPM will add a trailing\nslash when it stores the config. You must specify a trailing slash in your URL\nor the code will not be idempotent.\n\nExamples:\n\n```puppet\nnodejs::npm::global_config_entry { 'proxy':\n  ensure =\u003e 'present',\n  value  =\u003e 'http://proxy.company.com:8080/',\n}\n```\n\n```puppet\nnodejs::npm::global_config_entry { 'dev':\n  ensure =\u003e 'present',\n  value  =\u003e 'true',\n}\n```\n\nDelete the key from all configuration files:\n\n```puppet\nnodejs::npm::global_config_entry { 'color':\n  ensure =\u003e 'absent',\n}\n```\n\nIf a global_config_entry of `proxy` or `https-proxy` is specified, this will be\napplied before the local installation of npm packages using `nodejs::npm`.\n\n## Limitations\n\nSee [`metadata.json`](metadata.json) for supported operating systems.\n\n### Module dependencies\n\nThis modules uses `puppetlabs-apt` for the management of the NodeSource\nrepository. If using an operating system of the Debian-based family, you will\nneed to ensure that `puppetlabs-apt` version 4.4.0 or above is installed.\n\nIf using CentOS/RHEL and you wish to install Node.js from EPEL rather\nthan from the NodeSource repository, you will need to ensure `puppet-epel` is\ninstalled and is applied before this module.\n\nIf using Gentoo, you will need to ensure `gentoo-portage` is installed.\n\nIf using Windows, you will need to ensure that `puppetlabs-chocolatey` is\ninstalled.\n\nnodejs::npm has the ability to fetch npm packages from Git sources. If you\nwish to use this functionality, Git needs to be installed and be in the\n`PATH`.\n\n## Development\n\nSee [CONTRIBUTING](CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-nodejs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvoxpupuli%2Fpuppet-nodejs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvoxpupuli%2Fpuppet-nodejs/lists"}