prisma: Prisma generate script throws error

When I’m trying to run this example: https://github.com/prisma/prisma-examples/tree/master/typescript/graphql-auth

I’m getting the following problem. When running npm i I get this error:

> @prisma/client@2.0.0-preview025 postinstall /Users/yan/Projects/prisma-examples/typescript/graphql-auth/node_modules/@prisma/client
> node scripts/postinstall.js

Error: ENOENT: no such file or directory, mkdir

... Skip lines. Everything is ok here ...

> prisma2 generate

Error: ENOENT: no such file or directory, mkdir
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! graphql-auth@ generate:prisma: `prisma2 generate`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the graphql-auth@ generate:prisma script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yan/.npm/_logs/2020-03-31T06_04_32_492Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! graphql-auth@ generate: `npm run generate:prisma && npm run generate:nexus`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the graphql-auth@ generate script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yan/.npm/_logs/2020-03-31T06_04_32_519Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! graphql-auth@ postinstall: `npm run generate`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the graphql-auth@ postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yan/.npm/_logs/2020-03-31T06_04_32_556Z-debug.log

and here is the above mentioned log file contents:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'run',
1 verbose cli   'generate:prisma'
1 verbose cli ]
2 info using npm@6.14.4
3 info using node@v13.7.0
4 verbose run-script [ 'pregenerate:prisma', 'generate:prisma', 'postgenerate:prisma' ]
5 info lifecycle graphql-auth@~pregenerate:prisma: graphql-auth@
6 info lifecycle graphql-auth@~generate:prisma: graphql-auth@
7 verbose lifecycle graphql-auth@~generate:prisma: unsafe-perm in lifecycle true
8 verbose lifecycle graphql-auth@~generate:prisma: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/yan/Projects/prisma-examples/typescript/graphql-auth/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/yan/Projects/prisma-examples/typescript/graphql-auth/node_modules/.bin:/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/yan/Projects/prisma-examples/typescript/graphql-auth/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle graphql-auth@~generate:prisma: CWD: /Users/yan/Projects/prisma-examples/typescript/graphql-auth
10 silly lifecycle graphql-auth@~generate:prisma: Args: [ '-c', 'prisma2 generate' ]
11 silly lifecycle graphql-auth@~generate:prisma: Returned: code: 1  signal: null
12 info lifecycle graphql-auth@~generate:prisma: Failed to exec generate:prisma script
13 verbose stack Error: graphql-auth@ generate:prisma: `prisma2 generate`
13 verbose stack Exit status 1
13 verbose stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
13 verbose stack     at EventEmitter.emit (events.js:321:20)
13 verbose stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack     at ChildProcess.emit (events.js:321:20)
13 verbose stack     at maybeClose (internal/child_process.js:1026:16)
13 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid graphql-auth@
15 verbose cwd /Users/yan/Projects/prisma-examples/typescript/graphql-auth
16 verbose Darwin 19.0.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "generate:prisma"
18 verbose node v13.7.0
19 verbose npm  v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error graphql-auth@ generate:prisma: `prisma2 generate`
22 error Exit status 1
23 error Failed at the graphql-auth@ generate:prisma script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

I tried to remove node_modules and install again with no luck.

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 25 (9 by maintainers)

Commits related to this issue

Most upvoted comments

bash-3.2$ chown -R node_modules/.prisma node:node
chown: node_modules/.prisma: illegal user name

I had this issue in my docker container. Mine was fixed by changing the ownership of the node_modules/.prisma folder from root to the default one.

Can you please elaborate on this @aarjan ?

I changed it from root to node chown -R node_modules/.prisma node:node

I upgraded node to the latest version (node v13.12.0, npm 6.14.4) and it gave me a better error output:

Error: EACCES: permission denied, mkdir '/Users/yan/.cache/prisma'

So after creating this directory manually it worked fine!

@timsuchanek I’m running into this same issue on the the 2.0.0-beta.2 version, but not locally. I went to deploy the upgrade on AWS Elastic Beanstalk and started getting this error. The version I had previously deployed was preview021 and it worked just fine. I’ve been trying to track down if there are permissions issues or something but am having no luck. I totally get that there are a million use cases and build environments to consider so I’m not expecting anyone to know and fix my problem. Just wanted to update that there are probably a lot of other use cases where this will cause problems.

image

Whats interesting to me is that i see those logs, and then the failure. I’m not sure how to provide more information on this bad boy. But I’m happy to answer questions and help dig into it.

@janpio no luck with the latest version as well. Here is the full log after running npm i in prisma-examples/typescript/graphql-auth directory: https://gist.github.com/yantakus/5466d99495d6a719435aca23d7f9c8e4