エラー状況
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"
}
これでサイトページが正しく表示されるようになりました。