keystone icon indicating copy to clipboard operation
keystone copied to clipboard

@latest GeneratorError while generating prisma schemas

Open perlohmann opened this issue 4 years ago • 8 comments

Bug report

Updated to @latest version and tried to run the project resolving in this error. (win10 + VS Code)

Describe the bug

when running keystone-next dev it fails with the following error

> keystone-next dev

✨ Starting Keystone
⭐️ Dev Server Ready on http://localhost:4000
✨ Generating GraphQL and Prisma schemas
GeneratorError: TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
    at validateString (internal/validators.js:124:11)
    at Object.dirname (path.js:583:5)
    at Object.generateClient (%node_modules%\@prisma\client\generator-build\index.js:73493:80)
    at Object.onGenerate (%node_modules%\@prisma\client\generator-build\index.js:78783:34)
    at LineStream.<anonymous> (%node_modules%\@prisma\client\generator-build\index.js:2800:40)
    at LineStream.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at LineStream.Readable.push (internal/streams/readable.js:223:10)
    at LineStream.Transform.push (internal/streams/transform.js:166:32)
    at GeneratorProcess.handleResponse (%project-path%\backend\node_modules\@keystone-next\keystone\node_modules\@prisma\generator-helper\src\GeneratorProcess.ts:132:25)
    at LineStream.<anonymous> (%project-path%\backend\node_modules\@keystone-next\keystone\node_modules\@prisma\generator-helper\src\GeneratorProcess.ts:105:18)
    at LineStream.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9)
    at LineStream.Readable.push (internal/streams/readable.js:223:10)
    at LineStream.Transform.push (internal/streams/transform.js:166:32)
    at LineStream._pushBuffer (%project-path%\backend\node_modules\@keystone-next\keystone\node_modules\@prisma\generator-helper\src\byline.ts:119:17)
    at LineStream._transform (%project-path%\backend\node_modules\@keystone-next\keystone\node_modules\@prisma\generator-helper\src\byline.ts:110:8)
    at LineStream.Transform._read (internal/streams/transform.js:205:10) {
  code: -32000,
  data: null
}

To Reproduce

upgrade dependencies to the following:

"dependencies": {
    "@keystone-next/admin-ui": "^14.0.0",
    "@keystone-next/auth": "^21.0.0",
    "@keystone-next/fields": "^7.0.0",
    "@keystone-next/keystone": "^16.0.0",
    "dotenv": "^8.2.0",
    "next": "^10.1.3",
    "react": "^17.0.1",
    "react-dom": "^17.0.1"
  },

Unknown if it is upgrading an existing db project will cause the issue or if it happens with a fresh project.

Expected behaviour

I expect the project to build and run

Screenshots

System information

  • Windows 10
  • VS Code

Additional context

perlohmann avatar Apr 21 '21 08:04 perlohmann

I got this too, had to revert back to a previous version

ashhitch avatar Apr 23 '21 20:04 ashhitch

Hi @perlohmann, thanks for raising this issue and also surfacing it on Slack (https://keystonejs.slack.com/archives/C01STDMEW3S/p1619072873324100).

If anyone else is experiencing this issue, could you please delete your node_modules folder, your lock file (package-lock.json or yarn.lock file) and your .keystone folder and install your dependencies.

Please let us know if you continue to have issues!

bladey avatar Apr 28 '21 05:04 bladey

@bladey I tried that and still the same error. Even tried removing the schema.graphql and schema.prisma files. postinstall also fails with the same error.

ashhitch avatar Apr 28 '21 07:04 ashhitch

Further update ... seems to be a Yarn issue... using NPM solves it

ashhitch avatar Apr 28 '21 09:04 ashhitch

Thanks @ashhitch.

bladey avatar Apr 29 '21 01:04 bladey

Related Slack discussion - https://keystonejs.slack.com/archives/C01STDMEW3S/p1619073144326000

bladey avatar Apr 29 '21 06:04 bladey

Further update ... seems to be a Yarn issue... using NPM solves it

Yes, can confirm switching to npm fixed it for me too. It breaks every time I run yarn install and npm i fixes it.

borisno2 avatar Apr 29 '21 06:04 borisno2

It looks like there hasn't been any activity here in over 6 months. Sorry about that! We've flagged this issue for special attention. It wil be manually reviewed by maintainers, not automatically closed. If you have any additional information please leave us a comment. It really helps! Thank you for you contribution. :)

stale[bot] avatar Aug 28 '21 17:08 stale[bot]

Marked as stale, if anyone can reproduce this problem, please comment or open a new issue

dcousens avatar Nov 14 '23 01:11 dcousens