嘗試在rails專案中安裝mysql2時出現PGP關鍵問題
P粉155832941
2023-09-01 23:57:11
<p>我正在嘗試在本地安裝 Rails 專案的所有 gem。 </p>
<p>我的 mysql2 有問題。當我嘗試安裝它時,出現以下錯誤:</p>
<pre class="brush:php;toolbar:false;">Fetching mysql2-0.5.5.gem
Temporarily enhancing PATH for MSYS/MINGW...
Installing required msys2 packages: mingw-w64-x86_64-libmariadbclient
error: mingw32: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" is unknown
error: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" could not be looked up remotely
error: mingw64: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" is unknown
error: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" could not be looked up remotely
error: msys: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" is unknown
error: key "5F944B027F7FE2091985AA2EFA11531AA0AA7F57" could not be looked up remotely
error: database 'mingw32' is not valid (invalid or corrupted database (PGP signature))
error: database 'mingw64' is not valid (invalid or corrupted database (PGP signature))
error: database 'msys' is not valid (invalid or corrupted database (PGP signature))
pacman failed with the following output:
Building native extensions with: '--with-mysql-lib="C:\Program Files\MySQL\MySQL Server 8.0\lib" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 8.0\include"'
This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.</pre>
<p>然後我嘗試執行 <code>pacman -Syu</code>,但也出現相同的錯誤,並且沒有要求我匯入 PGP 金鑰。 </p>
<p>因此,我嘗試根據 MSI 金鑰環 GitHub 中的 pacman-key --add </code> 手動匯入金鑰。然後,我使用 <code>pacman-key --edit-key</code> 將信任改為 Ultimate。</p>
<p>但現在,我遇到了另一個錯誤:</p>
<pre class="brush:php;toolbar:false;">Installing required msys2 packages: mingw-w64-x86_64-libmariadbclient
error: could not open file /var/lib/pacman/sync/mingw32.db: Child process exited with status 127
error: could not open file /var/lib/pacman/sync/mingw64.db: Child process exited with status 127
error: could not open file /var/lib/pacman/sync/msys.db: Child process exited with status 127
error: target not found: mingw-w64-x86_64-libmariadbclient
pacman failed with the following output:
Building native extensions with: '--with-mysql-lib="C:\Program Files\MySQL\MySQL Server 8.0\lib" --with-mysql-include="C:\Program Files\MySQL\MySQL Server 8.0\include"'
This could take a while...
ERROR: Error installing mysql2:
ERROR: Failed to build gem native extension.</pre>
<p>我不知道我是否以這種方式添加了錯誤的密鑰,或者錯誤是否來自其他原因。我已經為此苦苦掙扎了好幾天,我有點迷失了。有人可以幫忙嗎? </p>
您安裝的 MSYS2 或 pacman 套件管理器似乎可能有問題。子進程以狀態 127 退出可能表示存在各種問題。
以下是我們可以嘗試解決此錯誤的一些方法:
如果這不起作用,我們可以嘗試重新安裝 MSYS2。
另一種方法可能是刪除 pacman 快取並重試。您可以透過以下方式執行此操作:
請注意 mingw-w64-x86_64-libmariadbclient 出現錯誤,您應該確認已安裝所有必要的開發套件。
可能還有一個開發包。在 Ubuntu 上它是“sudo apt install libmariadb-dev”或類似的東西,但我不確定對於 Arch Linux。