How to solve "The procedure entry point GetHostNameW could not be located in the dynamic link library WS2_32.dil" when command "heroku create"

Viewed 654

I get "The procedure entry point GetHostNameW could not be located in the dynamic link library WS2_32.dil" error when I command Heroku create . I already installed Heroku cli on my computer. For the first time (first project) it (Heroku create) worked fine. But the 2nd time when I gave this command it gave me an error.

After a long research on the internet I could not get rid of this error.

Now please tell me how I can solve this problem ? Note: My OS is Windows 7

2 Answers

PROBLEMO

Heroku CLI current latest version (as of July 2022) is 7.60.2, which was forced by auto-update onto our machine regardless of our OS version; this CLI version somehow used WS2_32.dll with GetHostNameW API that only applicable to Windows 8+. Error:

Node.exe - The procedure entry point GetHostNameW could not be located in the dynamic link library WS2_32.dll

No Heroku problem-ticket was open as far as I know (and Heroku PROHIBITS me from opening a new ticket!)

SOLUTION

This is a "hack" (temporary) solution until - hopefully - Heroku addresses this issue! Basically we will force our local machine Heroku CLI to use the previous version that was working before the latest update.

  1. Open: [YourLocalUserFolder]\AppData\Local\heroku\autoupdate.log => Go to the last update log (typically the LAST line at the bottom of the file), and see which version that was working before the latest updates who broke it. Example:

waiting until 2022-07-23T22:40:33.199Z to update time to update heroku: Updating CLI... heroku: Updating CLI from 7.59.2 to 7.60.2... done

  1. From this log, we found that the currently used CLI is v. 7.60.2. This version is the one broke my CLI on Windows 7, causing the error. The solution here is to go back and use the previously working version: 7.59.2

  2. Go to and make backup of the following:

    • Folder [YourLocalUserFolder]\AppData\Local\heroku\client\7.59.2 => As: [YourLocalUserFolder]\AppData\Local\heroku\client\7.59.2_BACKUP_20220723. Why? This is the WORKING CLI version, so we want to preserve it from Heroku auto-delete!

    • (Optional) File [YourLocalUserFolder]\AppData\Local\heroku\client\bin\heroku.cmd => As: [YourLocalUserFolder]\AppData\Local\heroku\client\bin\heroku.cmd_ORIG_20220723. Why? This is the original CMD file containing the latest syntax after Heroku latest update. We are going to modify this file.

  3. Modify file: [YourLocalUserFolder]\AppData\Local\heroku\client\bin\heroku.cmd => with the following:

"%~dp0..\7.59.2\bin\heroku.cmd" %*

  • What it is: To modify the last line only, change from whatever latest version to "7.59.2" version. By doing this, when we run heroku CLI again, it shall use this version, and not the latest one.
Related