Start tracking your progress
Trailhead Home
Trailhead Home

Set Up Your Salesforce DX Environment

Learning Objectives

In this project, you’ll:

  • Install Salesforce CLI.
  • Install Visual Studio Code and extensions for Salesforce DX.
  • Create and deploy a Lightning web component.

Introduction

Lightning Web Components is a new programming model for building Lightning components. It uses web standards breakthroughs, can coexist and interoperate with the Aura programming model, and delivers unparalleled performance. To create and develop Lightning Web Components and use their powerful features and performance benefits, you need to set up Salesforce DX. For this Quick Start, you also use Visual Studio Code, which is the recommended code editor for developing on the Salesforce platform. Once your developer environment is ready, you learn how to write a simple Lightning web component and add it to a page in Lightning Experience.

The Salesforce Developer Experience (DX) is a set of tools that streamlines the entire development life cycle. It improves team development and collaboration, facilitates automated testing and continuous integration, and makes the release cycle more efficient and agile.

Set Up Your Trailhead Playground 

Create a new Trailhead Playground.

  1. To create a new Trailhead Playground, click the dropdown at the end of this step and select Create a Trailhead Playground.    
    The Create a Trailhead Playground dropdown in a project's verify step challenge.
  2. Once you have a Trailhead Playground, click Launch.

Reset your password. You need both your username and password to authenticate your Trailhead Playground with the Salesforce CLI in a later step. 

If you see a tab in your org labeled Get Your Login Credentials, great! Follow the steps below. If not, from the App Launcher(App Launcher),  find and select Playground Starter and follow the steps. If you don’t see the Playground Starter app, check out Find the Username and Password for Your Trailhead Playground on Trailhead Help.

  1. Click the Get Your Login Credentials tab and take note of your username.
  2. Click Reset My Password. This sends an email to the address associated with your username.
  3. Click the link in the email.
  4. Enter a new password, confirm it, and click Change Password

Install the Command Line Interface (CLI)

Use the Salesforce CLI to control the full application life cycle of your Salesforce apps. With it you can easily create environments for development and testing, synchronize source code between your orgs and VCS, and execute tests. 

  1. Install the CLI using the links below.
    Operating System
    Link to Installer
    macOS
    https://sfdc.co/sfdx_cli_osx
    Right-click the application you just downloaded and click Open. If you see a warning, click Open.
    The Create a Trailhead Playground dropdown in a project's verify step challenge.
    The warning tells you that the app wasn’t registered with Apple by an identified developer. In this case you know that the app comes from a trusted source, so it’s OK to open it. In general, review apps downloaded from the internet carefully—or send them to your company’s security team for review—before opening them.
    Windows 32-bit
    https://sfdc.co/sfdx_cli_win
    It may be necessary to update your Class Path with the bin directory if you are not the only account on your machine.
    Windows 64-bit
    https://sfdc.co/sfdx_cli_win64
    It may be necessary to update your Class Path with the bin directory if you are not the only account on your machine.
    Debian/Ubuntu 64
    https://sfdc.co/sfdx_cli_linux
    Download the archive from one of the URLs in the manifest, extract the archive, then run the ./install script.
    Debian/Ubuntu x86
    https://sfdc.co/sfdx_cli_linux_x86
    Download the archive from one of the URLs in the manifest, extract the archive, then run the ./install script.
  2. Let’s make sure the CLI is properly installed and you know how to access online help for the commands. In a command window, enter sfdx.

    You see something like this:
    Salesforce CLI
    
    VERSION
      sfdx-cli/7.36.0-sfdx-cli/7.36.0-b1c4e9c7c8 darwin-x64 node-v10.15.3
    
    USAGE
      $ sfdx [COMMAND]
    
    COMMANDS
      commands  list all the commands
      force     tools for the Salesforce developer
        

In our next step, we set up our local development environment with Visual Studio Code.

We won’t check any of your setup. Click Verify Step to go to the next step in the project.