Make fixup: also check if yarn cache is broken and clean it if necessary

If `yarn cache list` fails, this can also lead to weird errors during
fixup, like
```
error /schildichat-desktop/matrix-react-sdk/node_modules/cypress: Command failed.
Exit code: 1
Command: node index.js --exec install
Arguments:
Directory: /schildichat-desktop/matrix-react-sdk/node_modules/cypress
Output:
node:internal/modules/cjs/loader:433
      throw err;
      ^

Error: Cannot find module '/schildichat-desktop/matrix-react-sdk/node_modules/human-signals/build/src/main.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (node:internal/modules/cjs/loader:425:19)
    at Function.Module._findPath (node:internal/modules/cjs/loader:638:18)
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1012:27)
    at Function.Module._load (node:internal/modules/cjs/loader:871:27)
    at Module.require (node:internal/modules/cjs/loader:1098:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object.<anonymous> (/schildichat-desktop/matrix-react-sdk/node_modules/execa/lib/error.js:2:25)
    at Module._compile (node:internal/modules/cjs/loader:1196:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
    at Module.load (node:internal/modules/cjs/loader:1074:32) {
  code: 'MODULE_NOT_FOUND',
  path: '/schildichat-desktop/matrix-react-sdk/node_modules/human-signals
```
This commit is contained in:
SpiritCroc 2023-04-22 10:11:16 +02:00 committed by su-ex
parent 979be00158
commit 0eb99a6a60

View File

@ -4,6 +4,7 @@
.PHONY: container-build-debian container-build-fedora .PHONY: container-build-debian container-build-fedora
.PHONY: container-web-release container-debian-release container-rpm-release container-appimage-release .PHONY: container-web-release container-debian-release container-rpm-release container-appimage-release
.PHONY: clean undo_setup fixup .PHONY: clean undo_setup fixup
.PHONY: fix_yarn_cache
CFGDIR ?= configs/sc CFGDIR ?= configs/sc
@ -182,6 +183,9 @@ bom.lock: element-desktop/yarn.lock element-web/yarn.lock matrix-js-sdk/yarn.loc
./build-bom.sh ./build-bom.sh
bom: bom.lock bom: bom.lock
fix_yarn_cache:
$(YARN) cache list || $(YARN) cache clean
clean: clean:
$(YARN) --cwd matrix-js-sdk clean $(YARN) --cwd matrix-js-sdk clean
$(YARN) --cwd matrix-react-sdk clean $(YARN) --cwd matrix-react-sdk clean
@ -195,7 +199,7 @@ clean:
undo_setup: undo_setup:
rm -rf element-desktop/node_modules element-web/node_modules matrix-react-sdk/node_modules matrix-js-sdk/node_modules i18n-helper/node_modules element-desktop/.hak rm -rf element-desktop/node_modules element-web/node_modules matrix-react-sdk/node_modules matrix-js-sdk/node_modules i18n-helper/node_modules element-desktop/.hak
fixup: undo_setup fixup: undo_setup fix_yarn_cache
make setup make setup
make clean make clean
make setup make setup