Skip to content

Polymer 3.0 installation

01es edited this page Mar 15, 2021 · 14 revisions

This article describes how to install Polymer 3.0.

Before you install Polymer you should make sure that all prerequisites were properly installed and their versions are supported by Polymer.

Install the Polymer 3.0 prerequisites

  1. Install Git, the detail information about how to install git can be fond here: Install Git

  2. Install npm and Node.js. Currently Polymer supports node 8.x and 10.x versions and npm v3 or newer. If you have previously installed node and npm, please make sure that their versions are supported, and update them otherwise. You can choose one of the options below to install Node.js and npm:

    For those who has previously installed node and wants to update to newer version please see this instruction:Update node and npm. To make sure that you have installed supported versions of Node.js and npm please run next commands and see the versions:

    node -v

    npm -v

Install Polymer CLI

Install Polymer CLI using the following command: npm install -g polymer-cli. If the previous command caused an exception, then please try this command: sudo npm install -g polymer-cli and as the last resort, use this one: sudo npm install --unsafe-perm=true -g polymer-cli. After that please make sure that polymer was installed properly, to do that please restart the terminal and type: polymer --version. If you can see the Polymer-CLI version then everything is fine, otherwise you can create a link for the installed polymer. In order to do that you should know where it was installed. The next command: npm root -g will print out the path to the global npm directory where all global packages should be installed. Then create link using this command:

sudo ln -s $GLOBAL_NPM_PATH/polymer-cli/bin/polymer.js /usr/bin/polymer

replacing $GLOBAL_NPM_PATH with the path received by the previous command.

In order to install polymer on windows please follow this Instruction in section: Installing Polymer CLI pre-requisites on Windows 10

Install Polymer components

In order to install or update Polymer and its components to use them in TG application one may cd to platform-web-ui/src/main/resources directory and run install-polymer.sh (for linux) or install-polymer.bat (for Windows) script.

Install vulcanisation tools

Three node components are required: rollup, rollup-plugin-root-import and terser. Install them by running npm install -g rollup, npm install -g rollup-plugin-root-import and npm install -g terser.

Running vulcaniser

In order to run vulcanise, two environment variables need to be specified as parameters to the Java process:

  1. NODE_PATH -- for Ubuntu this could be /usr/local/lib/nodejs/node-v10.15.0/lib/node_modules, for macOS this could be /usr/local/lib/node_modules, for Windows this could be C:\Users\<user>\AppData\Roaming\npm\node_modules.

  2. NODE_OPTIONS -- vulcanisation is memory hangry; need to specify this variable as --max-old-space-size=3072.

Please refer two screen captures below as an example for configuring a runner in Eclipse.

Run Configuration->Main

Run Configuration->Arguments

The following program arguments worked under Windows:

application.properties C:\Progra~1\nodejs;C:\Users\<user>\AppData\Roaming\npm NODE_PATH=C:\Users\<user>\AppData\Roaming\npm\node_modules NODE_OPTIONS="--max-old-space-size=3072"

In addition, if an application is intended to be run in the "time-zone independent" mode, vulcanisation must be performed with the same time-zone as intended for deployment. A time-zone should be specified as a JVM parameters. For example, -Duser.timezone=America/New_York. The time-zone value gets encoded into the vulcanised resource.

Clone this wiki locally