prisma: npx prisma db push throws Invalid version: "0.1.0.6"
Bug description
I’m following this example https://docs.planetscale.com/tutorials/prisma-quickstart but everytime I try to run “npx prisma db push” it throws:
Environment variables loaded from .env
Error: Invalid version: "0.1.0.6"
Super weird error, doesn’t tell me anything.
How to reproduce
Run “npx prisma db push”
Expected behavior
Pushes to the db
Prisma information
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
referentialIntegrity = "prisma"
}
generator client {
provider = "prisma-client-js"
previewFeatures = ["referentialIntegrity"]
}
model Star {
id Int @default(autoincrement()) @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
name String @db.VarChar(255)
constellation String @db.VarChar(255)
}
Environment & setup
- OS:
- Database:
- Node.js version:
Macos 12.3.1 Planetscale Node 16.1.0
Prisma Version
npx prisma -v results in same error
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 17 (5 by maintainers)
FINALLY FIXED IT!
For me the issue was with my package.json file. When doing “npm init”, somehow the version was added as: “0.1.” When I changed it to “0.1.0”, then it started working fine.
The correct pkg.json is as follows:
So the theory is that setting an “invalid” (non semver MAJOR.MINOR.PATCH) version in the project’s
package.jsonfile leads to an error when runningnpx prisma db push?Really annoying error. Same problem in here.