Legacy Knowledge Base
Published Jul. 2, 2025

nodejs download fails due to invalid link

Written By

Zalán Szakolci

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • Customers may encounter failures using Gradle v.4 + Workspace. Here is the relevant stacktrace exception:

    > Task :downloadNode FAILED
    Trying to download http://mirrors.lax.liferay.com/nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.gz to /home/jenkins/.liferay/mirrors/nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.gz.tmp
    Trying to download http://nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.gz to /home/jenkins/.liferay/mirrors/nodejs.org/dist/v10.15.1/node-v10.15.1-linux-x64.tar.gz.tmp
    FAILURE: Build failed with an exception.
    * What went wrong:
    Execution failed for task ':downloadNode'.
    > Redirection detected from http to https. Protocol switch unsafe, not allowed.

Environment

  • Gradle v.4 + Workspace
  • Liferay DXP 7.0+

Resolution

  • Apply the following in build.gradle as a workaround:
    import com.liferay.gradle.util.OSDetector
    
    buildscript {
     dependencies {
      classpath group: "com.liferay", name: "com.liferay.gradle.util", version: "1.0.34"
     }
     repositories {
      mavenCentral()
     }
    }
    
    allprojects {
     plugins.withId("com.liferay.node") {
      def nodeArch
      def nodeExt
      def nodeOS
     
      if (OSDetector.getBitmode().equals("32")) 
          nodeArch = "x86"
      else
          nodeArch = "x64"
    
      if (OSDetector.isWindows()) 
          nodeExt = "zip"
      else
          nodeExt = "tar.gz"
    
      if (OSDetector.isApple()) 
          nodeOS = "darwin";
      else if (OSDetector.isWindows()) 
          nodeOS = "win";
      else
          nodeOS = "linux"
     
      node {
          nodeUrl = "https://nodejs.org/dist/v${nodeVersion}/node-v${nodeVersion}-${nodeOS}-${nodeArch}.${nodeExt}"
      }
     }
    }

Additional Information

  • There has been a change to how downloads from nodejs.com switch from http -> https.  The fix is already in place for Gradle v.5 + latest Workspace plugin versions. However, those customers using Gradle v.4 + Liferay Workspace plugin version 2.1.5 or lower will need to use the aforementioned build.gradle workaround
    The workaround fixes the issue by overriding the nodeURL property which is normally automatically calculated by our node plugin.

 

 

Did this article resolve your issue ?

Legacy Knowledge Base