This module provides tools for installing Node.js and managing packages using npm.

fabtools.nodejs.install_from_source(version='0.10.13', checkinstall=False)[source]

Install Node JS from source.

If checkinstall is True, a distribution package will be built.

import fabtools

# Install Node.js


This function may not work for old versions of Node.js.


Get the version of Node.js currently installed.

Returns None if it is not installed.

fabtools.nodejs.install_package(package, version=None, local=False, npm='npm')[source]

Install a Node.js package.

If local is True, the package will be installed locally.

import fabtools

# Install package globally

# Install package locally
fabtools.nodejs.install_package('underscore', local=False)

Install Node.js package dependencies.

This function calls npm install, which will locally install all packages specified as dependencies in the package.json file found in the current directory.

from fabric.api import cd
from fabtools import nodejs

with cd('/path/to/nodejsapp/'):
fabtools.nodejs.package_version(package, local=False, npm='npm')[source]

Get the installed version of a Node.js package.

Returns None``is the package is not installed. If *local* is ``True, returns the version of the locally installed package.

fabtools.nodejs.update_package(package, local=False, npm='npm')[source]

Update a Node.js package.

If local is True, the package will be updated locally.

fabtools.nodejs.uninstall_package(package, version=None, local=False, npm='npm')[source]

Uninstall a Node.js package.

If local is True, the package will be uninstalled locally.

import fabtools

# Uninstall package globally

# Uninstall package locally
fabtools.nodejs.uninstall_package('underscore', local=False)