javascript - 无法生成 Prisma 客户端,outputDir.endsWith 不是函数
问题描述
我正在使用 Next.js、Prisma 和 Nexus (nexus-plugin-prisma),并且一直在尝试生成 Prisma 客户端但无济于事。每当我跑步时,npx prisma generate
我都会收到以下错误:
TypeError: outputDir.endsWith is not a function
at getDotPrismaDir (...)
at generateClient (...)
这些是我的依赖项:
"dependencies": {
"@prisma/client": "^2.19.0",
"apollo-server-micro": "^2.22.2",
"graphql": "^15.5.0",
"next": "10.1.3",
"nexus": "^1.0.0",
"nexus-plugin-prisma": "^0.33.0",
"react": "17.0.2",
"react-dom": "17.0.2"
},
"devDependencies": {
"@types/react": "^17.0.3",
"prisma": "^2.20.1",
"typescript": "^4.2.3"
}
}
我一直按照 Prisma CLI 的建议执行这些步骤(到第 3 步):
Next steps:
1. Set the DATABASE_URL in the .env file to point to your existing database. If your database has no tables yet, read https://pris.ly/d/getting-started
2. Set the provider of the datasource block in schema.prisma to match your database: postgresql, mysql or sqlite.
3. Run prisma db pull to turn your database schema into a Prisma data model.
4. Run prisma generate to install Prisma Client. You can then start querying your database.
这里发生了什么?
解决方案
更新@prisma/client
到prisma
最新版本,即2.20.1应该可以解决这个问题。
推荐阅读
- python - My list prints out the Objects instead of the values
- python-3.x - Reshaping 1-D Data to 2-D Data for Matplotlib Pcolormesh
- php - PHP parse array to get index wise result
- python - Scrapy - multiple spiders - processing data from one spider while other are still running
- apache-spark - PySpark 中的 ModuleNotFoundError 在 serializers.py 中引起
- python - bad key error occurred when tried to fetch data from api endpoint in python?
- apache-flink - Supported data types in Flink SQL
- apache-kafka - Kafka Schema Registry JSON Schema Restproxy 问题
- python - Python模块(pyenv)安装不起作用
- flutter - 如何在颤振中使用电报 api 创建消息模块