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.

  1. Remove your existing Node installation.

    sudo apt-get remove node npm
    
  2. Update your repositories.

    sudo apt-get update
    
  3. 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 -
    
  4. Install Node and NPM with a single command.

    sudo apt-get install -y nodejs
    
  5. 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 VersionNode VersionNPM VersionTheme Generator VersionGulp VersionYeoman Version
7.06.6.06.4.18.x.x2.x2.x
7.18.15.06.4.18.x.x2.x3.x
7.210.15.36.4.19.x.x & 10.x.x3.x & 4.x3.x
7.310.15.36.4.19.x.x & 10.x.x3.x & 4.x3.x
7.416.13.08.1.010.2.x4.x4.x

Capabilities

Product

Contact Us

Connect

Powered by Liferay
© 2024 Liferay Inc. All Rights Reserved • Privacy Policy