citadel.nodes.nodejs module

class citadel.nodes.nodejs.Nodejs(yml, path)[source]
Synopsis:

Sets up a nodejs runtime and its native npm.

Requirements:

None

Platform:

Any

Parameters:
  • node (optional) – The Node.js version to be installed.
  • npm (optional) – The NPM version to be installed.

Usage

1
2
3
nodejs:
  node: v7.5.0
  npm: 3.10.7

Sets up local nodejs and npm versions to be used across the generated script.

Looks for any http client in the system (wget or curl) in the path and downloads the binaries from nodejs.org that correspond to the version in the node directive. Once nodejs is setup, it then runs an npm install npm@version and ensures both the nodejs and npm executables are correctly configured in the PATH.

It will also print both the nodejs and npm versions that were configured into the log.

This directive depends on a working internet connection. If any proxy is required, remember to specific it either in the environment directive or directly passing the http proxy’s options using the -e "http_proxy=value" options through citadel-generate.

install_node(version)[source]

Installs nodejs from its primary location.

install_npm(version)[source]

Install npm, requires an already existing NPM version.

If node is also requested, it usually brings its own NPM as well.