はじめに
Prismaをインストールしたらエラーが発生しました。
問題
実行したコマンド
npx prisma@latest orm init --yes --target postgres --authoring psl --write-env
エラー内容(一部抜粋)
Error: ERR_PNPM_IGNORED_BUILDS
× adding a new package
╰─▶ Ignored build scripts: workerd@1.20260901.1
help: Run "pnpm approve-builds" to pick which dependencies should be allowed to run scripts.
✘ pnpm add -D prisma@latest
│ target: postgres
│ authoring: psl
│ schema: src/prisma/contract.prisma
✘ [CLI.INIT_INSTALL_FAILED] Failed to install dependencies
why: pnpm exited with code 1.
→ Run the install yourself: pnpm add -D prisma@latest
→ Emit the contract once the dependencies are installed: prisma contract emit
docs: https://docs.prisma.io/docs/orm/v8/reference/error-reference#CLI.INIT_INSTALL_FAILED
Prisma agent skills are out of date (installed @prisma/orm-postgres 8.0.0-rc.14, synced none). Run: prisma skills sync
解決方法
npmを使う場合
npm install -D prisma@latest
pnpmを使う場合
スクリプト実行を許可する
pnpm approve-builds
おわりに
Prismaをインストールしたら勝手にpnpmコマンドが走り、スクリプトの実行が許可されずエラーが起きたようです。
普段npmを使っているのでnpmで該当パッケージをインストールしなおしました。
