rebuild
rebuild copied to clipboard
How to clear the cache?
Is there a cache? The electron-rebuild
process completes really fast, which makes it seem like it is using results from a cache? If so, where is it so I can delete it?
I'm asking because I can't figure out how to get passed this issue: https://github.com/electron/electron/issues/20641 (different NODE_MODULE_VERSION numbers, and electron-rebuild
isn't solving it).
I believe the cache is in $HOME/.electron-gyp
on Mac/Linux and $env:HOMEPATH\.electron-gyp
on Windows, judging from this line: https://github.com/electron/electron-rebuild/blob/367e08129aea4a3099eb49986f90668e39a142e7/src/rebuild.ts#L397
But often the issue is a bad prebuild from prebuild-install
so you should also delete your prebuilds cache, which is usually at $HOME/.npm/_prebuilds
. See: https://github.com/prebuild/prebuild-install#cache
Just leaving a few links and some notes:
- This user had the same issue, and resolved it by manually building against their target electron version.
- better-sqlite3 issue that is similar. In this case, I think (but am not positive) the cause is an invalid prebuild uploaded
My current take away which may not be entirely accurate, is if an invalid prebuild is uploaded, it will be preferentially and consistently used resulting in the binary incompatibility issue. I am unsure why forcing a rebuild is still using the pre-built one. In the case of sqlite3, downgrading that library to the version prior to the invalid prebuild upload "fixes" it (and electron-rebuild falls back to manually building). ¯\_(ツ)_/¯