From 0eb99a6a606c6917f6676c2d4abcecaf1848d0f4 Mon Sep 17 00:00:00 2001 From: SpiritCroc Date: Sat, 22 Apr 2023 10:11:16 +0200 Subject: [PATCH] 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. (/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 ``` --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c517e5b..205cea9 100644 --- a/Makefile +++ b/Makefile @@ -4,6 +4,7 @@ .PHONY: container-build-debian container-build-fedora .PHONY: container-web-release container-debian-release container-rpm-release container-appimage-release .PHONY: clean undo_setup fixup +.PHONY: fix_yarn_cache 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 bom: bom.lock +fix_yarn_cache: + $(YARN) cache list || $(YARN) cache clean + clean: $(YARN) --cwd matrix-js-sdk clean $(YARN) --cwd matrix-react-sdk clean @@ -195,7 +199,7 @@ clean: 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 -fixup: undo_setup +fixup: undo_setup fix_yarn_cache make setup make clean make setup