next.js “npx prisma db seed”命令出现错误:命令失败,退出代码为1:编译器选项{“模块”:“CommonJS”} prisma/seed.ts

q0qdq0h2  于 2022-11-05  发布在  其他
关注(0)|答案(1)|浏览(190)

这是package.json文件

当我运行“npx prisma db seed”时,我收到此错误。运行seed命令时发生错误:错误:命令失败,退出代码为1:编译器选项{“模块”:“CommonJS”} prisma/seed.ts

{
  "name": "myapp",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@chakra-ui/layout": "^1.5.1",
    "@chakra-ui/react": "^1.7.2",
    "@dh-react-hooks/use-raf": "^0.9.1",
    "@emotion/react": "^11.6.0",
    "@emotion/styled": "^11.6.0",
    "@prisma/client": "^3.6.0",
    "bcrypt": "^5.0.1",
    "cookie": "^0.4.1",
    "cookies": "^0.8.0",
    "easy-peasy": "^5.0.4",
    "format-duration": "^1.4.0",
    "framer-motion": "^4.1.17",
    "jsonwebtoken": "^8.5.1",
    "next": "12.0.7",
    "react": "17.0.2",
    "react-dom": "17.0.2",
    "react-howler": "^5.2.0",
    "react-icons": "^4.3.1",
    "reset-css": "^5.0.1",
    "swr": "^1.1.1"
  },
  "devDependencies": {
    "@types/react": "^17.0.37",
    "@typescript-eslint/eslint-plugin": "^5.6.0",
    "@typescript-eslint/parser": "^5.6.0",
    "babel-plugin-superjson-next": "^0.4.2",
    "eslint": "^8.4.1",
    "eslint-config-airbnb": "^19.0.2",
    "eslint-config-next": "12.0.7",
    "eslint-config-prettier": "^8.3.0",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.27.1",
    "eslint-plugin-react-hooks": "^4.3.0",
    "prettier": "^2.4.1",
    "prisma": "^3.6.0",
    "ts-node": "^10.4.0",
    "typescript": "^4.8.4"
  },

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

qni6mghb1#

跟随棱镜docs
在步骤3中:
添加typescriptts-node@types/node开发依赖项:
在您的package.json中,devDependencies中没有@types/node,因此我认为您必须安装它,然后再次尝试播种

npm install -D @types/node

相关问题