Polymer 3.0 installation - fieldenms/tg GitHub Wiki
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 Git, the detail information about how to install git can be fond here: Install Git
-
Install npm and Node.js. Currently Polymer supports node 8.x => 22.x versions and npm 3.x => 10.x versions. 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:
- Download and install binaries. Detail documentation can be found here: Download Node and here: Node installation instruction. If you followed this instruction please do create links as it was described here: Create node links
- Install Node.js using Node Version Manager. The detail documentation is here: Install Node via nvm.
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
Installing through nvm
is a recommended way. If you want to have node / npm / rollup / terser etc.
on the path everywhere, place the following snippet into both .profile
and .bashrc|.zshrc
.
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
Also add the following snippet to .profile
to eliminate the need to specify NODE_PATH
and NODE_OPTIONS
in Vulcanize
launchers (in this case only [src/main/resources/]application-*.properties
will be needed).
export NODE_PATH="$(npm root -g)"
export NODE_OPTIONS="--max-old-space-size=3072"
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
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.
Three node components are required: rollup
, rollup-plugin-root-import
and terser
.
Install them by running npm install -g [email protected]
, npm install -g rollup-plugin-root-import
and npm install -g terser
.
In order to run vulcanise, two environment variables need to be specified as parameters to the Java process:
-
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 beC:\Users\<user>\AppData\Roaming\npm\node_modules
. -
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.
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.