2

So, it's been a while since I ran sfdx update and the update was larger than average (138 MB). After updating the CLI failed for 2 days straight, it finally worked for me this morning.

The next step that sfdx update runs is updating the plugins. Even without having any plugins installed other than the ones that come standard with sfdx, it appears that those too had a significant amount of data to download.

I've been getting the following error

error An unexpected error occurred: "https://registry.yarnpkg.com/rxjs/-/rxjs-6.6.7.tgz: ESOCKETTIMEDOUT".
sfdx-cli: Updating plugins... !
» Error: yarn add @salesforce/plugin-user@latest --non-interactive
» --mutex=file:C:\Users\[redacted]\AppData\Local\sfdx\yarn.lock
» --preferred-cache-folder=C:\Users\[redacted]\AppData\Local\sfdx\yarn --check-files exited with code 1

Before I received that error, the cli told me "there is an issue with your network. Retrying".

How do I fix this?

1 Answer 1

2

This answer assumes you're using Windows (7, 8, 10, 11, shouldn't matter)

The closest thing I was able to find was a github issue on installing the LWC Server which suggested that simply increasing a timeout value on a particular line would help.

Unfortunately, either the file mentioned is different for the LWC Server than it is for the SF CLI or that advice has become outdated (it was from 2020-01-24).

Thankfully, it provided me with enough of a hint to overcome it.

  1. Navigate to yarn's cli.js file, located in C:\Users\[redacted]\AppData\Local\sfdx\client\[your current sfdx version]\node_modules\yarn\lib
    • The AppData folder is normally hidden
    • [your current sfdx version] should be something like 7.152.0-3054818
  2. Open the file with a text editor like Notepad++ (basically just anything more advanced than Notepad or Wordpad)
  3. Find the var NETWORK_TIMEOUT = exports.NETWORK_TIMEOUT = 30 * 1000; // in milliseconds line
    • This was towards the start of the file for me, line 2173
  4. Increase the timeout
  5. Save the file with the changes
  6. Run sfdx update again

Changing 30 * 1000 (30 seconds) to 300 * 1000 (5 minutes) gave me enough leeway for yarn to download everything it needed to.

There was not, in fact, any issue with my network. That just appears to be a default "this is taking a while" message.

2
  • Would you want to mention what operating system you were? Jun 2 at 14:51
  • @MohithShrivastava added a note on my OS.
    – Derek F
    Jun 2 at 14:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.