NpmInstallAliases.

NpmInstall(ICakeContext, NpmInstallSettings) Method

Summary

Installs packages using the specified settings.
Assembly
Cake.Npm.dll
Namespace
Cake.Npm
Containing Type
NpmInstallAliases

Syntax

public static void NpmInstall(this ICakeContext context, NpmInstallSettings settings)

Examples

Install packages in a specific working directory ('npm install')

var settings = 
        new NpmInstallSettings 
        {
            WorkingDirectory = "c:\myproject"
        };
    NpmInstall(settings);

Force fetching of remote resources ('npm install --force')

var settings = 
        new NpmInstallSettings 
        {
            Force = true
        };
    NpmInstall(settings);

Install gulp globally ('npm install gulp -g')

var settings = 
        new NpmInstallSettings 
        {
            Global = true
        };
    settings.AddPackage("gulp");
    NpmInstall(settings);

Ignore devDependencies while installaling packages of the project in the current directory ('npm install --production')

var settings = 
        new NpmInstallSettings 
        {
            Production = true
        };
    NpmInstall(settings);

Use specific log level ('npm install')

var settings = 
        new NpmInstallSettings 
        {
            LogLevel = NpmLogLevel.Verbose
        };
    NpmInstall(settings);

Attributes

Type Description
CakeMethodAliasAttribute
CakeAliasCategoryAttribute

Parameters

Name Type Description
context ICakeContext The context.
settings NpmInstallSettings The settings.

Return Value

Type Description
void