prisma-nestjs-graphql
prisma-nestjs-graphql copied to clipboard
`yarn prisma generate` failed only in Docker
yarn prisma generate succeeds in the local environment, but fails with the following error when run in Docker.
Error: EIO: i/o error, open '/app/packages/backend/prisma/model/tenant-job/tenant-job-create-many-job.input.ts'
Strictly speaking, yarn prisma generate written in Dockerfile with docker-compose build succeeds, but it fails when I login to Docker after docker-compose up -d and run the same command.
It also succeeds when generator nestgraphql in schema.prisma is removed.
All log of command executions
/app # yarn @backend schema:generate
yarn run v1.22.5
$ yarn workspace backend schema:generate
$ yarn prisma generate
$ /app/node_modules/.bin/prisma generate
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Error:
✔ Generated Prisma Client (3.3.0) to ./../../node_modules/@prisma/client in 6.83s
Error: EIO: i/o error, open '/app/packages/backend/prisma/model/tenant-job/tenant-job-create-many-job.input.ts'
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed.
Exit code: 1
Command: /usr/local/bin/node
Arguments: /opt/yarn-v1.22.5/lib/cli.js schema:generate
Directory: /app/packages/backend
Output:
info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
error Command failed with exit code 1.
generator nestgraphql {
provider = "node ../../node_modules/prisma-nestjs-graphql"
output = "./model"
purgeOutput = true
}
PS I am managing multiple packages with monorepo using yarn workspace.
Are you able to create files/directories by node.js in docker? Check in docker: node fs.writeFileSync('foo.txt', '') fs.mkdirSync('bar')
It is hard to say what is the problem (error is very general), maybe something related to permissions or disk.
@unlight I ran the command you gave me and was able to create the files and directories without any problems.