Solved Error: Could not retrieve https://nodejs.org/dist/latest/SHASUMS256.txt during install node using nvm on windows


Recently, I had the opportunity to work on an Ionic project, for which I needed to set up Node.js on my Windows machine. I attempted to install multiple versions of Node.js by first installing nvm for Windows and then using the nvm command to install specific versions of Node.js from the command prompt.

but get below error: 

Could not retrieve https://nodejs.org/dist/latest/SHASUMS256.txt.

If you're facing the same error "Unable to install node using nvm on Windows Access is denied getting error: Could not retrieve https://nodejs.org/dist/latest/SHASUMS256.txt," you can resolve it by following these steps:

  1. Check Firewall and Antivirus: Sometimes, firewall or antivirus software can block network requests made by nvm. Temporarily disable your firewall or antivirus software and try installing Node.js again.
  2. Run Command Prompt as Administrator: Open Command Prompt as an administrator by right-clicking on the Command Prompt shortcut and selecting "Run as administrator." This ensures that nvm has the necessary permissions to download and install Node.js.
  3. Use HTTPS Proxy: If you're behind a corporate firewall or using a proxy server, configure nvm to use an HTTPS proxy. You can do this by setting the `HTTPS_PROXY` environment variable with the address of your proxy server.
  4. set HTTPS_PROXY=https://proxy-server-url:port
  5. Check Network Connection: Check that your computer has a stable internet connection and can access external websites. Sometimes, network connectivity issues can prevent nvm from downloading Node.js.
  6. Update nvm: Make sure that you are using the latest version of nvm. You can update nvm by running the following command:
  7. nvm install latest
  8. Try a Different Mirror: If the issue still persists, you can try using a different mirror for downloading Node.js. You can specify a mirror URL using the `NVM_NODEJS_ORG_MIRROR` environment variable.
  9. set NVM_NODEJS_ORG_MIRROR=https://nodejs.org/dist

Solution 2:

You can try this solution:

  1. Press the Windows key + X on our keyboard.
  2. Select "Windows PowerShell (Admin)".
  3. Now you can use nvm normally, and hopefully, you won't encounter any errors. If the issue persists, it might be related to another network-related issue. Additionally, I've encountered cases where toggling nvm off and then on again has resolved the problem after making configuration changes.

Launching PowerShell as an administrator might provide the necessary permissions for nvm to function properly, especially if the error is related to access rights. Toggling nvm off and on can sometimes reset its internal state, resolving any configuration conflicts that might be causing the issue.

Solution 3:

We might need to run the following command:

nvm proxy [url_proxy_server]

For example:

nvm proxy http://test.com:8080

If the issue persists, we can try another solution. I encountered a similar issue before, and adding a 'v' prefix before the actual version number worked perfectly for me.

You can try this:

nvm install v14.18.0

Setting the proxy server using the nvm proxy command can be helpful if our network requires it for external connections. This command tells nvm to use a specific proxy server for downloading node.js versions and packages.

 Adding the 'v' prefix before the version number might resolve any compatibility or parsing issues with nvm. Sometimes, the version format expected by nvm can vary, and adding the 'v' prefix ensures that nvm recognizes the version correctly.

Solution 4:

We encountered the same error while trying to install a different version of NodeJS. The error message stated that it could not retrieve https://nodejs.org/dist/latest/SHASUMS256.txt.

We found that running nvm install latest worked correctly after disconnecting from the VPN and opening PowerShell in admin mode. We suggest trying this approach.

Additionally, when facing similar errors on our Windows machine, switching from the stable version to the LTS (Long-Term Support) version resolved the issue for us. We used the following commands:

nvm install lts

nvm use lts

Running nvm install latest without the VPN and in admin mode might bypass any network restrictions or permissions issues, allowing the installation to proceed smoothly.

Switching to the LTS version ensures a more stable and supported version of NodeJS, which might have better compatibility with our environment.

Solution 5:

It seems that something is blocking our inbound connection at the network level. In this situation, NVM4W is merely delivering the message. We've noticed that older versions of Windows servers often have a tightly locked-down firewall, so our first step would be to check there. We should try accessing those URLs from a browser on the server to see if they are accessible.

Another possibility is that the Windows Certificate Trustchain doesn't recognize the TLS/SSL certificate of the remote server. In such cases, we can add --insecure to the end of the command to bypass the TLS/SSL validation step. However, we're inclined to believe it's more likely a firewall issue because TLS/SSL doesn't usually timeout when there's a problem; instead, it typically indicates that the remote host isn't trusted.

Regarding the firewall issue, if it turns out to be the case, we might need to adjust the firewall settings to allow access to the necessary URLs. If adding --insecure resolves the issue, it's a temporary workaround, but we should still investigate and address the root cause, which could be related to network security configurations.