2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

prismaを初期化したら謎のメッセージ(Error: (0 , KSe.isError) is not a function)が表示されて失敗した話

Last updated at Posted at 2024-12-19

はじめに

Next.jsプロジェクトにprismaを導入しようとしたら、
以下のようなメッセージが表示されてprismaの初期化に失敗したので、
原因と対応内容を備忘録として残します。

% npm install prisma --save-dev
% npx init prisma
Error: (0 , KSe.isError) is not a function

筆者のバージョン

% node -v
v23.4.0

% npx prisma --version
prisma                  : 6.1.0
@prisma/client          : 5.16.1

原因

Nodeの最新バージョンv23に対応していないためでした。
以下は現時点(2024/12/19)でのPrisma公式サイトの対応状況です。
iScreen Shoter - Google Chrome - 241219190731.jpg

対応

Nodeのバージョンを対応バージョンに差し戻します。
nというパッケージ管理ツールでダウングレードするのが簡単でした。
今回は22.11にダウングレードしてみます。

# n をインストールしていない場合
% sudo npm install -g n

# インストール確認
% npm list -g            
/usr/local/lib
├── corepack@0.30.0
├── n@10.1.0
└── npm@11.0.0

# 切り替え可能なバージョンの確認
% n ls-remote --all
23.4.0
23.3.0
23.2.0
23.1.0
23.0.0
22.12.0
22.11.0
...

# Nodeのダウングレード
% sudo n 22.11.0

% node -v
v22.11.0

もし切り替わらない場合は一度ターミナルを消して、
再度node -vを実行してみてください。

再度prismaの初期化を実施してみる

% npx prisma init     

✔ Your Prisma schema was created at prisma/schema.prisma
  You can now open it in your favorite editor.

無事初期化することができました!

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?