Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status

RSS

nodejs (62) Versions 10.1.7

Installs/Configures node.js

Policyfile
Berkshelf
Knife
cookbook 'nodejs', '= 10.1.7', :supermarket
cookbook 'nodejs', '= 10.1.7'
knife supermarket install nodejs
knife supermarket download nodejs
README
Dependencies
Changelog
Quality 50%

nodejs-cookbook

Cookbook Version
CI State
OpenCollective
OpenCollective
License

Installs node.js/npm and includes a resource for managing npm packages

Maintainers

This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.

Requirements

Platforms

  • Debian/Ubuntu
  • RHEL/CentOS/Scientific/Amazon/Oracle
  • openSUSE
  • Windows

Note: Source installs require GCC 4.8+, which is not included on older distro releases

Chef

  • Chef Infra Client 15.3+

Cookbooks

  • ark

Usage

Include the nodejs recipe to install node on your system based on the default installation method:

include_recipe "nodejs"

Install methods

Package

Install node from packages:

node['nodejs']['install_method'] = 'package' # Not necessary because it's the default
include_recipe "nodejs"
# Or
include_recipe "nodejs::nodejs_from_package"

By default this will setup deb/rpm repositories from nodesource.com, which include up to date NodeJS packages. If you prefer to use distro provided package you can disable this behavior by setting node['nodejs']['install_repo'] to false.

Binary

Install node from official prebuilt binaries:

node['nodejs']['install_method'] = 'binary'
include_recipe "nodejs"

# Or
include_recipe "nodejs::nodejs_from_binary"

# Or set a specific version of nodejs to be installed
node.default['nodejs']['install_method'] = 'binary'
node.default['nodejs']['version'] = '5.9.0'
node.default['nodejs']['binary']['checksum'] = '99c4136cf61761fac5ac57f80544140a3793b63e00a65d4a0e528c9db328bf40'

# Or fetch the binary from your own location
node.default['nodejs']['install_method'] = 'binary'
node.default['nodejs']['binary']['url'] = 'https://s3.amazonaws.com/my-bucket/node-v7.8.0-linux-x64.tar.gz'
node.default['nodejs']['binary']['checksum'] = '0bd86f2a39221b532172c7d1acb57f0b0cba88c7b82ea74ba9d1208b9f6f9697'

Source

Install node from sources:

node['nodejs']['install_method'] = 'source'
include_recipe "nodejs"
# Or
include_recipe "nodejs::nodejs_from_source"

Chocolatey

Install node from chocolatey:

node['nodejs']['install_method'] = 'chocolatey'
include_recipe "nodejs"
# Or
include_recipe "nodejs::nodejs_from_chocolatey"

NPM

Npm is included in nodejs installs by default. By default, we are using it and call it embedded. Adding recipe nodejs::npm assure you to have npm installed and let you choose install method with node['nodejs']['npm']['install_method']

include_recipe "nodejs::npm"

Warning: This recipe will include the nodejs recipe, which by default includes nodejs::nodejs_from_package if you did not set node['nodejs']['install_method'].

Resources

npm_package

note: This resource was previously named nodejs_npm. Calls to that resource name will still function, but cookbooks should be updated for the new npm_package resource name.

npm_package lets you install npm packages from various sources:

  • npm registry:

    • name: property :package
    • version: property :version (optional)
  • url: property :url

    • for git use git://{your_repo}
  • from a json (package.json by default): property :json

    • use true for default
    • use a String to specify json file

Packages can be installed globally (by default) or in a directory (by using attribute :path)

You can specify an NPM_TOKEN environment variable for accessing NPM private modules by using attribute :npm_token

You can specify a NODE_ENV environment variable, in the case that some element of your installation depends on this by using attribute :node_env. E.g., using node-config as part of your postinstall script. Please note that adding the --production option will override this to NODE_ENV=production.

You can append more specific options to npm command with attribute :options array :

You can specify auto_update as false to stop the npm install command from running and updating an installed package. Running the command will update packages within restrictions imposed by a package.json file. The default behavior is to update automatically.

  • use an array of options (w/ dash), they will be added to npm call.
  • ex: ['--production','--force'] or ['--force-latest']

You can specify live_stream true for the resource to have the package install information included in the chef-client log outout for better npm package diagnostics and trouble shooting.

This LWRP attempts to use vanilla npm as much as possible (no custom wrapper).

Packages

npm_package 'express'

npm_package 'async' do
  version '0.6.2'
end

npm_package 'request' do
  url 'github mikeal/request'
end

npm_package 'grunt' do
  path '/home/random/grunt'
  json true
  user 'random'
  node_env 'staging'
end

npm_package 'my_private_module' do
  path '/home/random/myproject' # The root path to your project, containing a package.json file
  json true
  npm_token '12345-abcde-e5d4c3b2a1'
  user 'random'
  options ['--production'] # Only install dependencies. Skip devDependencies
end

[Working Examples](test/cookbooks/nodejs_test/recipes/npm.rb)

Or add packages via attributes (which accept the same attributes as the LWRP above):

"nodejs": {
  "npm_packages": [
    {
      "name": "express"
    },
    {
      "name": "async",
      "version": "0.6.2"
    },
    {
      "name": "request",
      "url": "github mikeal/request"
    }
    {
      "name": "grunt",
      "path": "/home/random/grunt",
      "json": true,
      "user": "random"
    }
  ]
}

Contributors

This project exists thanks to all the people who contribute.

Backers

Thank you to all our backers!

https://opencollective.com/sous-chefs#backers

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website.

https://opencollective.com/sous-chefs/sponsor/0/website
https://opencollective.com/sous-chefs/sponsor/1/website
https://opencollective.com/sous-chefs/sponsor/2/website
https://opencollective.com/sous-chefs/sponsor/3/website
https://opencollective.com/sous-chefs/sponsor/4/website
https://opencollective.com/sous-chefs/sponsor/5/website
https://opencollective.com/sous-chefs/sponsor/6/website
https://opencollective.com/sous-chefs/sponsor/7/website
https://opencollective.com/sous-chefs/sponsor/8/website
https://opencollective.com/sous-chefs/sponsor/9/website

Dependent cookbooks

ark >= 2.0.2
chocolatey >= 3.0
yum >= 7.2

Contingent cookbooks

301 Applicable Versions
appium Applicable Versions
application_nodejs Applicable Versions
azurecli Applicable Versions
base_image Applicable Versions
boilerplate Applicable Versions
cabot Applicable Versions
camo Applicable Versions
cdap Applicable Versions
cloudless-box Applicable Versions
containership Applicable Versions
cube Applicable Versions
docker-etcd-registrator Applicable Versions
dreadnot Applicable Versions
errbit-server Applicable Versions
etherpad Applicable Versions
etherpad-lite Applicable Versions
foreflight_build_agent Applicable Versions
ghost Applicable Versions
ghost-blog Applicable Versions
guardian Applicable Versions
hipache Applicable Versions
hubot Applicable Versions
huginn Applicable Versions
iisnode Applicable Versions
influxdb Applicable Versions
infochimps_statsd Applicable Versions
jenkins_build Applicable Versions
kronia Applicable Versions
lifeguard Applicable Versions
manta Applicable Versions
meteor Applicable Versions
mimo Applicable Versions
modcloth-hubot Applicable Versions
mozilla-firefox-accounts Applicable Versions
mozilla-firefox-sync Applicable Versions
myusa Applicable Versions
newrelic-sysmond-policy Applicable Versions
node-express-chef-quickstart Applicable Versions
nodejs-deploy Applicable Versions
nodestack Applicable Versions
noosfero Applicable Versions
npm Applicable Versions
npm_lazy Applicable Versions
npm_registry Applicable Versions
oc-id Applicable Versions
omakase Applicable Versions
opsworks_ruby Applicable Versions
pa11y Applicable Versions
pita Applicable Versions
pm2 Applicable Versions
prose Applicable Versions
protractor Applicable Versions
railsbox Applicable Versions
razor Applicable Versions
rethinkdb Applicable Versions
rocketchat Applicable Versions
ruby-env-cookbook Applicable Versions
sinopia Applicable Versions
sonos Applicable Versions
statsd Applicable Versions
statsd-centos7 Applicable Versions
strongloop Applicable Versions
supermarket Applicable Versions
tekno-mineos Applicable Versions
treslek Applicable Versions
uchiwa Applicable Versions
uptime Applicable Versions
verdaccio Applicable Versions
webapp Applicable Versions
webhook Applicable Versions
zf2 Applicable Versions

NodeJS Cookbook Changelog

10.1.7 - 2023-04-01

Standardise files with files in sous-chefs/repo-management

10.1.6 - 2023-03-20

Standardise files with files in sous-chefs/repo-management

10.1.5 - 2023-03-15

Standardise files with files in sous-chefs/repo-management

Standardise files with files in sous-chefs/repo-management

10.1.4 - 2023-02-20

Standardise files with files in sous-chefs/repo-management

Standardise files with files in sous-chefs/repo-management

10.1.3 - 2023-02-15

10.1.2 - 2023-02-14

Standardise files with files in sous-chefs/repo-management

10.1.1 - 2022-12-08

Standardise files with files in sous-chefs/repo-management

10.1.0 - 2022-08-08

  • To ensure consistent environment between npm install and npm list, pass same environment variables.

10.0.1 - 2022-08-07

  • Standardise files with files in sous-chefs/repo-management
  • Default to using EL 9 repo for Fedora
  • CI: Remove Fedora from source suite

10.0.0 - 2022-04-21

  • Update to NodeJS 17.x
  • Remove delivery and move to calling RSpec directly via a reusable workflow
  • Update tested platforms
  • Disable upstream DNF module on EL8 based systems

9.0.2 - 2022-02-17

  • Standardise files with files in sous-chefs/repo-management

9.0.1 - 2022-02-08

  • Remove delivery folder

9.0.0 - 2021-09-13

  • Update the default version to 14 LTS
  • Remove testing for EOL platforms
  • Add Debian 11 testing
  • Fix release version to use for Amazon Linux

8.0.0 - 2021-09-02

  • Update metadata and README to Sous Chef
  • Enable unified_mode by default and require at least Chef Infra Client 15.3
  • Cookstyle fixes

7.3.3 - 2021-08-30

  • Standardise files with files in sous-chefs/repo-management

7.3.2 - 2021-06-01

  • Standardise files with files in sous-chefs/repo-management

7.3.1 - 2020-12-31

  • resolved cookstyle error: attributes/packages.rb:15:55 convention: Layout/TrailingEmptyLines
  • resolved cookstyle error: test/cookbooks/test/recipes/resource.rb:118:1 convention: Layout/TrailingEmptyLines
  • Enable builds for opensuse-leap-15
  • Add a library method test

7.3.0 (2020-10-21)

  • Add rspec tests for the library methods
  • Update the url_invalid? method to return false if it detects an invalid uri
  • Add the auto_update option to the npm_package resource. Allows turning off auto_update of npm packages.
  • Allow actions and options for OS package installation to be specified as attributes
  • Add the live_stream parameter to the npm_package execution to get better installation diagnostics
  • Add the auto_update option to the npm_package resource. Allows turning off auto_update of npm packages.
  • Update testing

7.2.0 (2020-10-07)

  • Verify the URI of installed packages to help determine if a good URI has been installed
  • Add tests that verify npm-package installed packages
  • Get the example test cookbook working
  • Add support for installing node on windows

7.1.0 (2020-10-01)

  • resolved cookstyle error: recipes/nodejs_from_binary.rb:19:1 refactor: ChefCorrectness/IncorrectLibraryInjection
  • resolved cookstyle error: recipes/nodejs_from_source.rb:21:1 refactor: ChefCorrectness/IncorrectLibraryInjection
  • resolved cookstyle error: recipes/npm_from_source.rb:21:1 refactor: ChefCorrectness/IncorrectLibraryInjection
  • Have ark setup node and npm binaries into PATH
  • Add node_env to npm_package in order to set NODE_ENV (useful for some packages)
  • Include npx as a binary in addition to npm, it has been included since npm v5.2.0

7.0.1 (2020-06-04)

  • Minor readme fix

7.0.0 (2020-06-04)

  • Require Chef Infra Client 14+ and remove the build-essential dependency
  • Updated the default to Node.js v10.16.3
  • Added compatibility with Chef Infra Client 16.2+
  • Removed Foodcritic testing
  • Updated ChefSpec and Kitchen platforms
  • Resolved multiple minor cookstyle issues in the cookbook
  • Added a vscode editor config

6.0.0 (2018-10-11)

  • Use the build_essential resource in the source install recipe instead of the build-essential::default recipe. This way we can use the new built-in build_essential resource in Chef 14+
  • Set default version to Node.js v8.12.0

5.0.0 (2017-11-15)

  • nodejs_npm resource has been converted to a custom resource and renamed to npm_package. The existing resource name will continue to function, but over time code should be updated for the new name. This name change has been made so we can eventually merge this resource into the chef-client.
  • compat_resource cookbook dependency has been removed and this cookbook instead requires Chef 12.14 or later
  • Chef 13 compatibility has been resolved
  • The npm_package resource now properly installs packages when the 'package' property is setA
  • Speed up npm operations by only returning a list of the desired package instead of every npm package
  • Speed up source installation by using multipackage install for the dependencies
  • Remove the broken url_valid? helper which didn't work

4.0.0 (2017-07-11)

  • Updated the cookbook to require Chef 12.1+ and the compat_resource cookbook
  • Removed support for io.js which has merged back into the node.js project
  • Removed the dependency on homebrew, yum-epel, and apt cookbooks
  • Added node['nodejs']['manage_node'] attribute to use only cookbook's LWRP (required to manage node by nvm)
  • Updated the default repository URLs to be the 6.X repos
  • Added initial support for Suse and Amazon Linux
  • Improved architecture detection to support aarch64
  • Improved readme with examples for fetching your own binaries
  • Added installation of openssl and xz utilities that are needed for the binary install recipe
  • Updated the cookbook license string to be an SPDX compliant string
  • Set the minimum version of the ark cookbook to 2.0.2 in order to support Suse
  • Updated the default version from 6.9.1 to 6.10.2
  • Switched to Delivery local mode for testing
  • Added Integration testing in Travis CI with kitchen-dokken and ChefDK

3.0.0 (2016-11-02)

  • Updated the default release to the nodejs 6.9.1. This requires C++11 extensions to compile, which are only present in GCC 4.8+. Due to this RHEL 5/6 and Ubuntu 12.04 are not supported if using this version.
  • Switched the download URLs to the .xz packages since the .tar.gz packages are no longer being created
  • Improvements to the readme examples and requirements sections
  • Removed installation of apt-transport-https and instead rely on an apt cookbook that will do the same
  • Fixed the ChefSpec matchers
  • Added Scientific, Oracle, and Amazon as supported distros in the metadata
  • Added chef_version metadata
  • Removed conflicts and suggests metadata which aren't implemented or recommended for use
  • Removed Chef 10 compatibility code
  • Switched Integration testing to Inspec from bats
  • Added the Apache 2.0 license file to the repo
  • Expanded Test Kitchen testing
  • Switched from Rubocop to Cookstyle and resolved all warnings
  • Switched Travis to testing using ChefDK

2.4.4

  • Use HTTPS prefix URLs for node download #98
  • Update NPM symlink when installing from source #105
  • Add support for NPM private modules #107

v2.4.2

  • Fix check version
  • Support iojs package install

v2.4.0

  • Move npm_packages to his own recipe
  • Fix different race conditions when using direct recipe call
  • Fix npm recipe

v2.3.2

  • Fix package recipe

v2.3.0

  • Support io.js. Use node['nodejs']['engine'].
  • Add MacOS support via homebrew

v2.2.0

  • Add node['nodejs']['keyserver']
  • Update arm checksum
  • Fix npm_packages JSON

v2.1.0

  • Use official nodesource repository
  • Add node['nodejs']['npm_packages'] to install npm package with default recipe

v2.0.0

  • Travis integration
  • Gems updated
  • Rewrite cookbook dependencies
  • Added complete test-kitchen integration : Rake, rubocop, foodcritic, vagrant, bats testing ...
  • Added NodeJS install_method option (sources, bins or packages)
  • Added NPM install_method option (sources or packages)
  • NPM version can now be chosen independently from nodejs' embedded version
  • Added a nodejs_npm LWRP to manage, install and resolve NPM packages

v1.3.0

  • update default versions to the latest: node - v0.10.15 and npm - v1.3.5
  • default to package installation of nodejs on smartos (@wanelo-pair)
  • Add Raspberry pi support (@robertkowalski)

v1.2.0

  • implement installation from package on RedHat - (@vaskas)

v1.1.3

  • update default version of node to 0.10.13 - and npm - v1.3.4 ([@jodosha][])

v1.1.2

  • update default version of node to 0.10.2 - (@bakins)
  • fully migrated to test-kitchen 1.alpha and vagrant 1.1.x/berkshelf 1.3.1

v1.1.1

  • update default versions to the latest: node - v0.10.0 and npm - v1.2.14
  • make_thread is now a real attribute - (@ChrisLundquist)

v1.1.0

  • rewrite the package install; remove rpm support since there are no longer any packages available anywhere
  • add support to install legacy_packages from ubuntu repo as well as the latest 0.10.x branch (this is default).

v1.0.4

  • add support for binary installation method (@JulesAU)

v1.0.3

  • 7.3.1 - 2020-12-31

v1.0.2

  • add smartos support for package install (@sax)
  • support to compile with all processors available (default 2 if unknown) - (@ChrisLundquist)
  • moved to platform_family syntax
  • ensure npm recipe honours the 'source' or 'package' setting - (@markbirbeck)
  • updated the default versions to the latest stable node/npm

v1.0.1

  • fixed bug that prevented overwritting the node/npm versions (moved the src_urls as local variables instead of attributes) - (@johannesbecker)
  • updated the default versions to the latest node/npm

v1.0.0

  • added packages installation support (@smith)

Collaborator Number Metric
            

10.1.7 passed this metric

Contributing File Metric
            

10.1.7 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a CONTRIBUTING.md file

Cookstyle Metric
            

10.1.7 passed this metric

No Binaries Metric
            

10.1.7 passed this metric

Testing File Metric
            

10.1.7 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must contain a TESTING.md file

Version Tag Metric
            

10.1.7 failed this metric

Failure: To pass this metric, your cookbook metadata must include a source url, the source url must be in the form of https://github.com/user/repo, and your repo must include a tag that matches this cookbook version number