Syncfusion license key should be registered, if your project using Syncfusion JavaScript(ES6) packages reference. The generated license key is a string that needs to be registered after any Syncfusion JavaScript(ES6) reference.
Note: Syncfusion license validation is done offline during application execution and does not require internet access. Apps registered with a Syncfusion license key can be deployed on any system that does not have an internet connection.
Generate the Syncfusion license key and register it in one of the following ways,
Register the license key at the entry point of the project before using the Syncfusion controls.
As we have mandated license registration for the Syncfusion JavaScript components, we realize there is a possibility to view the registered Syncfusion License key from your application by others. We acknowledge this is taking place in the JavaScript platform, as we have minimal scope for hiding the License key and we also recommend not to advertise it.
// Registering Syncfusion license key
import { registerLicense } from '@syncfusion/ej2-base';
registerLicense('License key');
Only from 2022 Vol 1 v20.1.0.47, license key registration required for Essential JavaScript 2 products.
Register the Syncfusion license key through npx command in one of the following ways,
If both the license text file and the environment variable are used for license registration, priority is set to
syncfusion-license.txt
file. If you want to use the environment variable for license registration, then remove the license text file from the application.
The following steps show how to register the Syncfusion license key with the license text file.
syncfusion-license.txt
file in the application root directory and paste the license key.npx syncfusion-license activate
Once the Syncfusion license key is activated, the following console message will appear.
License message:
(INFO) Syncfusion License imported successfully.
link
.If you don’t want to use the license text file in the application, refer to this link to use an environment variable and register the Syncfusion license key.
You can set the environment variable as SYNCFUSION_LICENSE
in the system and paste the license key as a value. It can be used in all applications on your machine.
The following steps show how to set environment variable in different operating systems and register the Syncfusion license key.
setx SYNCFUSION_LICENSE "license key"
env
command to view the variables list.echo 'export SYNCFUSION_LICENSE="license key"' >> ~/.bash_profile
nano .bash_profile
ctrl+x
to exit then Y
and Enter
button to save the changes.env
command.env
command to view the variables list.export SYNCFUSION_LICENSE='license key'
SYNCFUSION_LICENSE
environment variable, restart the IDE or application terminal before using the license activation command.npx syncfusion-license activate
Once the Syncfusion license key is activated, the following console message will appear.
License message:
(INFO) Syncfusion License imported successfully.
link
.The following sections show how to use an environment variable in CI services.
SYNCFUSION_LICENSE
and use the license key as a value. steps:
- name: Install node modules
run: npm install
- name: Activate Syncfusion License
run: npx syncfusion-license activate
env:
SYNCFUSION_LICENSE: ${{ secrets.SYNCFUSION_LICENSE }}
SYNCFUSION_LICENSE
. Use the license key as a value.The following example shows the syntax for Windows build agents.
pool:
vmImage: 'windows-latest'
steps:
- script: call npm install
displayName: 'Install node modules'
- script: call npx syncfusion-license activate
displayName: 'Activate Syncfusion License'
env:
SYNCFUSION_LICENSE: $(SYNCFUSION_LICENSE)
The following example shows the syntax for Linux build agents.
pool:
vmImage: 'ubuntu-latest'
steps:
- script: npm install
displayName: 'Install node modules'
- script: npx syncfusion-license activate
displayName: 'Activate Syncfusion License'
env:
SYNCFUSION_LICENSE: $(SYNCFUSION_LICENSE)
SYNCFUSION_LICENSE
. Use the license key as a value.# Activate the license
npx syncfusion-license activate