diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project
index 461ab31539bf8becd4e5e2f4597192fc40116e8b..c913ea8a12cb5d72ce88c100bdea3f3919decdeb 100644
--- a/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project
+++ b/cabal-testsuite/PackageTests/VersionPriority/1-web-constraints-import.project
@@ -2,3 +2,4 @@ packages: .
 allow-newer: hashable:*
 constraints: hashable ==1.4.2.0
 import: https://www.stackage.org/nightly-2023-12-07/cabal.config
+import: with-ghc.config
diff --git a/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project
index 6eebd83af30ad91ea2744811097e9524614a2a61..d5eff428498748d8415b67ae439d494c08d2b29a 100644
--- a/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project
+++ b/cabal-testsuite/PackageTests/VersionPriority/1-web-import-constraints.project
@@ -2,3 +2,4 @@ packages: .
 allow-newer: hashable:*
 import: https://www.stackage.org/nightly-2023-12-07/cabal.config
 constraints: hashable ==1.4.2.0
+import: with-ghc.config
diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project
index 2be7836ec6ec6ec8d57a7108865858a963fc6058..ccc8878de7eaae3c6e123b8a95a498ee6e9e755e 100644
--- a/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project
+++ b/cabal-testsuite/PackageTests/VersionPriority/2-web-constraints-import.project
@@ -2,3 +2,4 @@ packages: .
 allow-newer: hashable:*
 constraints: hashable ==1.4.2.0
 import: stackage-web.config
+import: with-ghc.config
diff --git a/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project
index 512f235dbbfb6350c037392b83fa443c5d2cdd01..a953355471d9e791224c9053c96ede1b0499a194 100644
--- a/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project
+++ b/cabal-testsuite/PackageTests/VersionPriority/2-web-import-constraints.project
@@ -2,3 +2,4 @@ packages: .
 allow-newer: hashable:*
 import: stackage-web.config
 constraints: hashable ==1.4.2.0
+import: with-ghc.config
diff --git a/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project b/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project
index 11f33600f96f82aee7bd94f82350218b87d923eb..74f5ef66fd9c24318c0633669a300d4c39549f79 100644
--- a/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project
+++ b/cabal-testsuite/PackageTests/VersionPriority/3-web-constraints-import.project
@@ -2,3 +2,4 @@ packages: .
 allow-newer: hashable:*
 constraints: hashable ==1.4.2.0
 import: hop-web.config
+import: with-ghc.config
\ No newline at end of file
diff --git a/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project b/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project
index 79b3be193273441f318af0f9ff01d893011a8d59..5a103e19a8051137f51459ef82cf04035d27bbdd 100644
--- a/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project
+++ b/cabal-testsuite/PackageTests/VersionPriority/3-web-import-constraints.project
@@ -2,3 +2,4 @@ packages: .
 allow-newer: hashable:*
 import: hop-web.config
 constraints: hashable ==1.4.2.0
+import: with-ghc.config
\ No newline at end of file
diff --git a/cabal-testsuite/PackageTests/VersionPriority/with-ghc.config b/cabal-testsuite/PackageTests/VersionPriority/with-ghc.config
new file mode 100644
index 0000000000000000000000000000000000000000..140a00be1b96b5eefa337aba3a06ed50b5358c08
--- /dev/null
+++ b/cabal-testsuite/PackageTests/VersionPriority/with-ghc.config
@@ -0,0 +1,7 @@
+-- WARNING: Override the `with-compiler: ghc-x.y.z` of the stackage import, of
+-- https://www.stackage.org/nightly-yyyy-mm-dd/cabal.config. Otherwise tests
+-- will fail with:
+--   -Error: [Cabal-5490]
+--   -Cannot find the program 'ghc'. User-specified path 'ghc-x.y.z' does not
+--    refer to an executable and the program is not on the system path.
+with-compiler: ghc