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

More than 1 year has passed since last update.

Prisma TypeScript環境でnpx prisma db seedがうまくいかない時

Posted at

package.jsonに以下を記入すれば動くと書いているが、エラーが出たときの対処法

package.json
  "prisma": {
    "seed": "ts-node prisma/seed.ts"
  }
❯ npx prisma db seed
Environment variables loaded from .env
Running seed command `ts-node  prisma/seed.ts` ...
(node:337002) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)

いろいろ試してみましたが、package.jsonのスクリプトを書き換えるのが一番シンプルで良かったです。

package.json
  "prisma": {
    "seed": "ts-node --compiler-options {\"module\":\"CommonJS\"} prisma/seed.ts"
  }

参考

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