Installing Serverless Framework

Last updated: 2021-01-05 15:12:29

    Overview

    You can quickly install Serverless Framework through npm or binary installation.

    Installing

    Method 1. Installation through npm

    Prerequisites

    Before installing through npm, you need to make sure that Node.js (above v10) and npm have been installed in your environment (for more information, please see Node.js Installation Guide) .

    $ node -v
    v12.18.0
    
    $ npm -v
    7.0.10

    Note:

    To ensure the installation speed and stability, we recommend you use cnpm for installation: download and install cnpm first, and then replace all the npm commands used below with cnpm commands.

    Installation steps

    Run the following command on the command line:

    npm install -g serverless

    Note:

    If macOS prompts that you have no permission, you need to run sudo npm install -g serverless for installation.

    If you have already installed Serverless Framework, you can run the following command to upgrade it to the latest version:

    npm update -g serverless

    Viewing version information

    After the installation is completed, run the serverless -v command to view the version information of Serverless Framework:

    serverless -v

    Method 2. Binary installation

    If Node.js is not installed in your local environment, you can install it directly in binary mode:

    macOS/Linux

    Open the command line and enter the following command:

    curl -o- -L https://slss.io/install | bash

    If you have already installed a binary version, you can run the following command to upgrade it:

    serverless upgrade

    Windows

    Windows supports installation through Chocolatey. Open the command line and enter the following command:

    choco install serverless

    If you have already installed a binary version, you can run the following command to upgrade it:

    choco upgrade serverless

    Viewing version information

    After the installation is completed, run the serverless -v command to view the version information of Serverless Framework:

    serverless -v

    Relevant Operations

    Next step: getting started

    Was this page helpful?

    Was this page helpful?

    • Not at all
    • Not very helpful
    • Somewhat helpful
    • Very helpful
    • Extremely helpful
    Send Feedback
    Help