1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

sharp の「Could not load the "sharp" module using the win32-x64 runtime」エラーの解決方法

Last updated at Posted at 2024-06-09

エラー状況

netlifyにビルド後、サイトページにアクセスしたところ、以下のように表示された。

Error
ERROR  Unhandled Promise Rejection

そのためFunction logを確認すると以下のように出力されていた。

ERROR  Unhandled Promise Rejection
{"errorType":
"Runtime.UnhandledPromiseRejection",
"errorMessage":
"Error: Could not load the \"sharp\" module using the linux-x64 runtime

... 略

解決方法

このサイトでも書いてある通り、plaiceholderはsharpのv0.32.1までしか対応していないとのこと。というわけで、package.jsonのsharpのバージョンを修正します。

package.json
  "dependencies": {
    "next": "14.2.2",
    "plaiceholder": "^3.0.0",
    "react": "^18",
    "react-dom": "^18",
    "sass": "^1.75.0",
-   "sharp": "^0.33.3"
+   "sharp": "^0.32.1"
  }

これでサイトページが正しく表示されるようになりました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?