The Polymer library is in maintenance mode. For new development, we recommend Lit.

You're viewing an older version of the Polymer library documentation. Please see Polymer 3.0 for the latest.

Polymer CLI is the official command line tool for Polymer projects and Web Components. It includes a build pipeline, a boilerplate generator for creating elements and apps, a linter, a development server, and a test runner.

Follow these instructions to install the Polymer CLI on a Linux or MacOS operating system.

For a suggested way to run the Polymer CLI on Windows 10, see the instructions below on Installing Polymer CLI pre-requisites on Windows 10.

  1. Make sure you have installed a version of Node.js supported by Polymer. To check the version of Node.js that you have installed, run:

    node --version
    

    See the official node version support policy for more details.

  2. Update npm.

    npm install npm@latest -g
    
  3. Ensure that Git is installed.

    git --version
    

    If it isn't, you can find it on the Git downloads page.

  4. Install the latest version of Bower.

    npm install -g bower
    
  5. Install Polymer CLI.

    npm install -g polymer-cli
    

    Bower deprecation warning: In the output from this command, you may see an npm warning about Bower being deprecated. You can safely ignore this warning. See Bower.io for more information.

You're all set. Run polymer help to view a list of commands.

Polymer CLI works with two types of projects:

  • Elements projects. In an element project, you expose a single element or group of related elements which you intend to use in other element or app projects, or distribute on a registry like Bower or NPM. Elements are reusable and organized to be used alongside other elements, so components are referenced outside the project.

    See the guide to creating an element project with the Polymer CLI for more information.

  • Application projects. In an app project, you build an application, composed of Polymer elements, which you intend to deploy as a website. Applications are self-contained, organized with components inside the application.

    See the guide to creating an application project with the Polymer CLI for more information.

See the documentation on Polymer CLI commands for a list of commands and how to use them.

There are multiple ways to install the pre-requisites for the Polymer CLI on a Windows 10 system. This method uses Bash on the Windows Subsystem for Linux.

For complete and up-to-date installation instructions for Bash on the Windows Subsystem for Linux, we recommend you review the Bash on ubuntu on Windows documentation.

  1. Check your OS build by selecting Start > System > OS Build.

    Make sure you have an x64 installation of Windows 10 with OS build > 14393.

  2. Open Settings > Update and Security > For developers and select Developer Mode.

  3. From the Start Menu, search for Turn Windows features on or off and select Windows Subsystem for Linux (beta).

  4. Restart your computer.

  5. Log in as Administrator.

  6. From a PowerShell prompt, run the following command:

    Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
    
  7. Open a Bash prompt:

    bash
    
  8. Follow the prompts to create a new user.

Your Bash installation is complete. You can start now start a new Bash prompt by typing bash from the Start menu.

For complete and up-to-date instructions, refer to the official documentation for installing Node with nvm.

  1. Type the following command to use an install script:

    curl -o- https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
    
  2. Restart your terminal by closing and re-opening your Bash prompt.

  3. Install the latest version of Node:

    nvm install node
    

Optionally, set a default browser so polymer serve --open has something to open. Use your own Path variable.

echo $'\n'export BROWSER=/mnt/c/Program\\\ Files\\\ \\\(x86\\\)/
Google/Chrome/Application/chrome.exe >> ~/.bashrc