2
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?

Next.js × pnpm で ERR_PNPM_IGNORED_BUILDS が出たときの対処法

2
Posted at

ERR_PNPM_IGNORED_BUILDS が出たときの対処法

Next.jsでpnpmを用いて新規アプリを作成して、
pnpm installをしたら以下のエラーが出てきました。

[ERR_PNPM_IGNORED_BUILDS] Ignored build scripts: sharp@0.34.5
Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.

なんじゃこれは?ってなってAIを使っても少し苦戦したので共有します!

原因

調べたら、pnpmセキュリティのため、ネイティブビルドスクリプトをデフォルトでブロックするみたいです。
sharp はインストール時にC++バイナリをコンパイルする必要があるため、明示的な許可が必要なんだそう。

解決方法

以下のコマンドで解決しました。

pnpm approve-builds sharp

その後

pnpm install
pnpm run dev

package.jsonpnpm.onlyBuiltDependencies に追加されて、以降は警告が出なくなりました。

2
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
2
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?