Node Version Information
Liferay DXP uses Node (and NPM) for many different frontend components. Specifically, the Liferay Theme Generator and Liferay’s JavaScript application tools require the use of NPM commands to build and deploy.
These dependencies are designed to use specific versions of Node and NPM. Check the Node version compatibility matrix to ensure you have the correct versions installed when developing themes or JavaScript applications.
Updating Your Node Version
If you have an old or unsupported version of Node installed for your Liferay installation, then you may need to update it to work correctly. Follow these steps to update Node to a specific major version.
-
Remove your existing Node installation.
sudo apt-get remove node npm
-
Update your repositories.
sudo apt-get update
-
Retrieve the desired major version of Node. Check the version compatibility matrix for the major version of Node required for your Liferay DXP version.
curl -sL deb.nodesource.com/setup_##.x | sudo -E bash -
For example, if you are using Liferay version 7.4, then run the following for version Node version
16.x
:curl -sL deb.nodesource.com/setup_16.x | sudo -E bash -
-
Install Node and NPM with a single command.
sudo apt-get install -y nodejs
-
Verify that you have the expected versions of Node and NPM.
node --version
npm --version
You should now have a supported version of Node and NPM for your Liferay installation (updated to the latest minor version that is supported). However, if your NPM version does not match the expected version, then you can install a specific version of NPM with this command:
npm install -g npm@x.x.x
Specifying a Module’s Node Version
If your module requires a specific version of Node, then you can configure this in your module’s build.gradle
file. For example, if your module requires Node version 10.15.3
and NPM version 6.4.1
, then you can add this code to the build.gradle
file:
node {
nodeVersion = "10.15.3"
npmVersion = "6.4.1"
}
Version Compatibility Matrix
Liferay Version | Node Version | NPM Version | Theme Generator Version | Gulp Version | Yeoman Version |
---|---|---|---|---|---|
7.0 | 6.6.0 | 6.4.1 | 8.x.x | 2.x | 2.x |
7.1 | 8.15.0 | 6.4.1 | 8.x.x | 2.x | 3.x |
7.2 | 10.15.3 | 6.4.1 | 9.x.x & 10.x.x | 3.x & 4.x | 3.x |
7.3 | 10.15.3 | 6.4.1 | 9.x.x & 10.x.x | 3.x & 4.x | 3.x |
7.4 - 2024.Q3 | 16.13.0 | 8.1.0 | 10.2.x | 4.x | 4.x |
2024.Q4+/7.4 GA129+ | 20.12.2 | 10.5.0 | N/A (Deprecated) | 4.x | 4.x |