SFDX 6.21.0-9db990b3c9 AND CURRENT Update - Error - sfdx no longer works

This happens to me every couple of days on a Mac.

A workaround is to delete the directory /Users/xxxx/.local/share/sfdx/client and then sfdx-cli will automatically upgrade on the next command your run. See Cannot find module package.json #666. This includes the comment:

as discussed in #653 this was due to a cleanup process that was too eager and deleted some essential files for some installs. A fix is out and if you're experiencing this, delete ~/.local/share/heroku/client and it should resolve itself.

PS

A colleague reports that "update Node.js to the latest (LTS) and update SFDX" stopped the problem from happening for him.


I got similar error on windows 10. I took a backup and deleted everything inside below folder and was able to update CLI to latest version.

C:\Users\\AppData\Local\sfdx\client