Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error generating the Prisma client #404

Closed
AndrewSverdrup opened this issue Apr 8, 2020 · 43 comments · Fixed by #457
Closed

Error generating the Prisma client #404

AndrewSverdrup opened this issue Apr 8, 2020 · 43 comments · Fixed by #457
Labels
bug/confirmed We have confirmed this is a bug topic/prisma

Comments

@AndrewSverdrup
Copy link

AndrewSverdrup commented Apr 8, 2020

I am following the tutorial here https://redwoodjs.com/tutorial/installation-starting-development, and am running into an error. Here are my project files (just the generated starter files minus the node_modules folder) and the commands I've run:

Project zip: redwoodblog.zip

$ node -v
v13.12.0
$ yarn -v
1.22.4
$ yarn create redwood-app ./redwoodblog

yarn create v1.22.4
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Installed "create-redwood-app@0.4.0" with binaries:
      - create-redwood-app
  ✔ Creating Redwood app
    ✔ Creating directory '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog'
    ✔ Downloading latest release
    ✔ Extracting latest release
    ✔ Clean up
  ✔ Installing packages
    ✔ Checking node and yarn compatibility
    ✔ Running `yarn install`... (This could take a while)

Thanks for trying out Redwood! We've created your app in '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog'

Inside that directory you can run `yarn rw dev` to start the development server.
✨  Done in 119.41s.

Error Output: yarn rw dev

Click details below to view.

```bash $ cd redwoodblog $ yarn rw dev

yarn run v1.22.4
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/rw' dev
✖ Generating the Prisma client...
→ info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Command failed with exit code 1: yarn prisma2 generate
Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/prisma2' generate
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/dev-server'
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/webpack-dev-server' --config ../node_modules/@redwoodjs/core/config/webpack.development.js
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/prisma2' generate --watch
21:39:28 db | Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
21:39:28 db | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn prisma2 generate --watch exited with code 1
21:39:28 db | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn prisma2 generate --watch restarted
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/prisma2' generate --watch
21:39:30 db | Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
21:39:30 db | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn prisma2 generate --watch exited with code 1
21:39:30 db | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn prisma2 generate --watch restarted
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/prisma2' generate --watch
21:39:30 web | ℹ 「wds」: Project is running at http://localhost:8910/
21:39:30 web | ℹ 「wds」: webpack output is served from /
21:39:30 web | ℹ 「wds」: Content not from webpack is served from /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/web
21:39:30 web | ℹ 「wds」: 404s will fallback to /index.html
21:39:33 db | Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
21:39:33 db | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn prisma2 generate --watch exited with code 1
21:39:33 db | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn prisma2 generate --watch restarted
21:39:33 api | /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/@prisma/client/index.js:3
21:39:33 api | throw new Error(
21:39:33 api | ^
21:39:33 api |
21:39:33 api | Error: @prisma/client did not initialize yet. Please run "prisma2 generate" and try to import it again.
21:39:33 api | In case this error is unexpected for you, please report it in prisma/prisma-client-js#390.
21:39:33 api | at new PrismaClient (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/@prisma/client/index.js:3:11)
21:39:33 api | at Object. (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api/src/lib/db.js:6:19)
21:39:33 api | at Module._compile (internal/modules/cjs/loader.js:1147:30)
21:39:33 api | at Module._compile (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/pirates/lib/index.js:99:24)
21:39:33 api | at Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
21:39:33 api | at Object.newLoader [as .js] (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/pirates/lib/index.js:104:7)
21:39:33 api | at Module.load (internal/modules/cjs/loader.js:996:32)
21:39:33 api | at Function.Module._load (internal/modules/cjs/loader.js:896:14)
21:39:33 api | at Module.require (internal/modules/cjs/loader.js:1036:19)
21:39:33 api | at require (internal/modules/cjs/helpers.js:72:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
21:39:33 api | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn dev-server exited with code 1
21:39:33 api | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn dev-server restarted
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/prisma2' generate --watch
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/dev-server'
21:39:35 db | Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
21:39:35 db | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn prisma2 generate --watch exited with code 1
21:39:37 api | /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/@prisma/client/index.js:3
21:39:37 api | throw new Error(
21:39:37 api | ^
21:39:37 api |
21:39:37 api | Error: @prisma/client did not initialize yet. Please run "prisma2 generate" and try to import it again.
21:39:37 api | In case this error is unexpected for you, please report it in prisma/prisma-client-js#390.
21:39:37 api | at new PrismaClient (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/@prisma/client/index.js:3:11)
21:39:37 api | at Object. (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api/src/lib/db.js:6:19)
21:39:37 api | at Module._compile (internal/modules/cjs/loader.js:1147:30)
21:39:37 api | at Module._compile (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/pirates/lib/index.js:99:24)
21:39:37 api | at Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
21:39:37 api | at Object.newLoader [as .js] (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/pirates/lib/index.js:104:7)
21:39:37 api | at Module.load (internal/modules/cjs/loader.js:996:32)
21:39:37 api | at Function.Module._load (internal/modules/cjs/loader.js:896:14)
21:39:37 api | at Module.require (internal/modules/cjs/loader.js:1036:19)
21:39:37 api | at require (internal/modules/cjs/helpers.js:72:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
21:39:38 api | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn dev-server exited with code 1
21:39:38 api | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn dev-server restarted
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/dev-server'
21:39:43 api | /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/@prisma/client/index.js:3
21:39:43 api | throw new Error(
21:39:43 api | ^
21:39:43 api |
21:39:43 api | Error: @prisma/client did not initialize yet. Please run "prisma2 generate" and try to import it again.
21:39:43 api | In case this error is unexpected for you, please report it in prisma/prisma-client-js#390.
21:39:43 api | at new PrismaClient (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/@prisma/client/index.js:3:11)
21:39:43 api | at Object. (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api/src/lib/db.js:6:19)
21:39:43 api | at Module._compile (internal/modules/cjs/loader.js:1147:30)
21:39:43 api | at Module._compile (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/pirates/lib/index.js:99:24)
21:39:43 api | at Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
at Object.newLoader [as .js] (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/pirates/lib/index.js:104:7)
21:39:43 api | at Module.load (internal/modules/cjs/loader.js:996:32)
21:39:43 api | at Function.Module._load (internal/modules/cjs/loader.js:896:14)
21:39:43 api | at Module.require (internal/modules/cjs/loader.js:1036:19)
21:39:43 api | at require (internal/modules/cjs/helpers.js:72:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
21:39:43 api | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn dev-server exited with code 1
21:39:43 api | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn dev-server restarted
$ '/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/.bin/dev-server'
21:39:49 api | /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/@prisma/client/index.js:3
21:39:49 api | throw new Error(
21:39:49 api | ^
21:39:49 api |
21:39:49 api | Error: @prisma/client did not initialize yet. Please run "prisma2 generate" and try to import it again.
21:39:49 api | In case this error is unexpected for you, please report it in prisma/prisma-client-js#390.
21:39:49 api | at new PrismaClient (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/@prisma/client/index.js:3:11)
21:39:49 api | at Object. (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api/src/lib/db.js:6:19)
21:39:49 api | at Module._compile (internal/modules/cjs/loader.js:1147:30)
21:39:49 api | at Module._compile (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/pirates/lib/index.js:99:24)
21:39:49 api | at Module._extensions..js (internal/modules/cjs/loader.js:1167:10)
21:39:49 api | at Object.newLoader [as .js] (/Users/Andrew/RedwoodJS_Tutorial/redwoodblog/node_modules/pirates/lib/index.js:104:7)
21:39:49 api | at Module.load (internal/modules/cjs/loader.js:996:32)
21:39:49 api | at Function.Module._load (internal/modules/cjs/loader.js:896:14)
21:39:49 api | at Module.require (internal/modules/cjs/loader.js:1036:19)
21:39:49 api | at require (internal/modules/cjs/helpers.js:72:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
21:39:49 api | cd /Users/Andrew/RedwoodJS_Tutorial/redwoodblog/api && yarn dev-server exited with code 1

</details>
@thedavidprice
Copy link
Contributor

@AndrewSverdrup thank you for reporting this. And sorry you ran into issues right out of the gate.

I used the .zip you included to test locally. I was unable to reproduce the error (yay/boo).

If you are still experiencing this, could you try the following:

Note: this will destroy any uncommitted work you have done

  • Remove all git-ignored files and uncommitted changes: git clean -fxd
  • Remove prisma cache: rm -rf ~/.cache/prisma
  • Re-install packages: yarn install
  • Do over! yarn rw dev

🤞😬

@turbotobias
Copy link

turbotobias commented Apr 10, 2020

Followed your steps and got the same result @thedavidprice

Removed global prisma CLI just to be sure.

Also, now created an entirely new project with instructions form https://redwoodjs.com/tutorial/installation-starting-development

  1. yarn create redwood-app ./redwoodblog
  2. cd redwoodblog
  3. yarn redwood dev

Same error as printed above :/

Full log
tobias@Tobiass-MacBook-Pro test-redwood % npm uninstall -g prisma --save
up to date in 0.04s
tobias@Tobiass-MacBook-Pro test-redwood % npm uninstall -g prisma2 --save
up to date in 0.034s
tobias@Tobiass-MacBook-Pro test-redwood % npm uninstall -g @prisma/cli
up to date in 0.032s
tobias@Tobiass-MacBook-Pro test-redwood % cd ../
tobias@Tobiass-MacBook-Pro Web % yarn create redwood-app ./redwoodblog
yarn create v1.21.1
warning package.json: No license field
[1/4] 🔍 Resolving packages...
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning " > @react-native-community/cli@4.3.0" has unmet peer dependency "react-native@^0.62.0-rc.0".
warning "@react-native-community/cli > metro-react-native-babel-transformer@0.58.0" has unmet peer dependency "@babel/core@*".
[4/4] 🔨 Building fresh packages...
success Installed "create-redwood-app@0.4.0" with binaries:
- create-redwood-app
✔ Creating Redwood app
✔ Creating directory '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog'
✔ Downloading latest release
✔ Extracting latest release
✔ Clean up
✔ Installing packages
✔ Checking node and yarn compatibility
✔ Running `yarn install`... (This could take a while)

Thanks for trying out Redwood! We've created your app in '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog'

Inside that directory you can run `yarn rw dev` to start the development server.
✨ Done in 30.18s.
tobias@Tobiass-MacBook-Pro Web % cd redwoodblog
tobias@Tobiass-MacBook-Pro redwoodblog % yarn redwood dev
yarn run v1.21.1
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/redwood' dev
✖ Generating the Prisma client...
→ info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
Command failed with exit code 1: yarn prisma2 generate
Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/prisma2' generate
info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/dev-server'
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/prisma2' generate --watch
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/webpack-dev-server' --config ../node_modules/@redwoodjs/core/config/webpack.development.js
14:32:40 db | Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
14:32:40 db | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn prisma2 generate --watch exited with code 1
14:32:40 db | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn prisma2 generate --watch restarted
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/prisma2' generate --watch
14:32:41 web | ℹ 「wds」: Project is running at [http://localhost:8910/](http://localhost:8910/)
14:32:41 web | ℹ 「wds」: webpack output is served from /
14:32:41 web | ℹ 「wds」: Content not from webpack is served from /Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/web
14:32:41 web | ℹ 「wds」: 404s will fallback to /index.html
14:32:41 api | /Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/@prisma/client/index.js:3
14:32:41 api | throw new Error(
14:32:41 api | ^
14:32:41 api |
14:32:41 api | Error: @prisma/client did not initialize yet. Please run "prisma2 generate" and try to import it again.
14:32:41 api | In case this error is unexpected for you, please report it in [https://github.com/prisma/prisma-client-js/issues/390](https://github.com/prisma/prisma-client-js/issues/390).
14:32:41 api | at new PrismaClient (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/@prisma/client/index.js:3:11)
14:32:41 api | at Object.<anonymous> (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/api/src/lib/db.js:6:19)
14:32:41 api | at Module._compile (internal/modules/cjs/loader.js:1151:30)
14:32:41 api | at Module._compile (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/pirates/lib/index.js:99:24)
14:32:41 api | at Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
14:32:41 api | at Object.newLoader [as .js] (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/pirates/lib/index.js:104:7)
14:32:41 api | at Module.load (internal/modules/cjs/loader.js:1000:32)
14:32:41 api | at Function.Module._load (internal/modules/cjs/loader.js:899:14)
14:32:41 api | at Module.require (internal/modules/cjs/loader.js:1040:19)
14:32:41 api | at require (internal/modules/cjs/helpers.js:72:18)
error Command failed with exit code 1.
info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
14:32:41 api | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn dev-server exited with code 1
14:32:41 api | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn dev-server restarted
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/dev-server'
14:32:41 db | Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
14:32:41 db | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn prisma2 generate --watch exited with code 1
14:32:41 db | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn prisma2 generate --watch restarted
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/prisma2' generate --watch
14:32:42 db | Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
14:32:42 db | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn prisma2 generate --watch exited with code 1
14:32:42 db | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn prisma2 generate --watch restarted
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/prisma2' generate --watch
14:32:42 api | /Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/@prisma/client/index.js:3
14:32:42 api | throw new Error(
14:32:42 api | ^
14:32:42 api |
14:32:42 api | Error: @prisma/client did not initialize yet. Please run "prisma2 generate" and try to import it again.
14:32:42 api | In case this error is unexpected for you, please report it in [https://github.com/prisma/prisma-client-js/issues/390](https://github.com/prisma/prisma-client-js/issues/390).
14:32:42 api | at new PrismaClient (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/@prisma/client/index.js:3:11)
14:32:42 api | at Object.<anonymous> (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/api/src/lib/db.js:6:19)
14:32:42 api | at Module._compile (internal/modules/cjs/loader.js:1151:30)
14:32:42 api | at Module._compile (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/pirates/lib/index.js:99:24)
14:32:42 api | at Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
14:32:42 api | at Object.newLoader [as .js] (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/pirates/lib/index.js:104:7)
14:32:42 api | at Module.load (internal/modules/cjs/loader.js:1000:32)
14:32:42 api | at Function.Module._load (internal/modules/cjs/loader.js:899:14)
14:32:42 api | at Module.require (internal/modules/cjs/loader.js:1040:19)
14:32:42 api | at require (internal/modules/cjs/helpers.js:72:18)
error Command failed with exit code 1.
info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
14:32:43 api | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn dev-server exited with code 1
14:32:43 api | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn dev-server restarted
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/dev-server'
14:32:43 db | Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
14:32:43 db | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn prisma2 generate --watch exited with code 1
14:32:44 api | /Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/@prisma/client/index.js:3
14:32:44 api | throw new Error(
14:32:44 api | ^
14:32:44 api |
14:32:44 api | Error: @prisma/client did not initialize yet. Please run "prisma2 generate" and try to import it again.
14:32:44 api | In case this error is unexpected for you, please report it in [https://github.com/prisma/prisma-client-js/issues/390](https://github.com/prisma/prisma-client-js/issues/390).
14:32:44 api | at new PrismaClient (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/@prisma/client/index.js:3:11)
14:32:44 api | at Object.<anonymous> (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/api/src/lib/db.js:6:19)
14:32:44 api | at Module._compile (internal/modules/cjs/loader.js:1151:30)
14:32:44 api | at Module._compile (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/pirates/lib/index.js:99:24)
14:32:44 api | at Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
14:32:44 api | at Object.newLoader [as .js] (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/pirates/lib/index.js:104:7)
14:32:44 api | at Module.load (internal/modules/cjs/loader.js:1000:32)
14:32:44 api | at Function.Module._load (internal/modules/cjs/loader.js:899:14)
14:32:44 api | at Module.require (internal/modules/cjs/loader.js:1040:19)
14:32:44 api | at require (internal/modules/cjs/helpers.js:72:18)
error Command failed with exit code 1.
info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
14:32:44 api | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn dev-server exited with code 1
14:32:44 api | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn dev-server restarted
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/dev-server'
14:32:46 api | /Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/@prisma/client/index.js:3
14:32:46 api | throw new Error(
14:32:46 api | ^
14:32:46 api |
14:32:46 api | Error: @prisma/client did not initialize yet. Please run "prisma2 generate" and try to import it again.
14:32:46 api | In case this error is unexpected for you, please report it in [https://github.com/prisma/prisma-client-js/issues/390](https://github.com/prisma/prisma-client-js/issues/390).
14:32:46 api | at new PrismaClient (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/@prisma/client/index.js:3:11)
14:32:46 api | at Object.<anonymous> (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/api/src/lib/db.js:6:19)
14:32:46 api | at Module._compile (internal/modules/cjs/loader.js:1151:30)
14:32:46 api | at Module._compile (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/pirates/lib/index.js:99:24)
14:32:46 api | at Module._extensions..js (internal/modules/cjs/loader.js:1171:10)
14:32:46 api | at Object.newLoader [as .js] (/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/pirates/lib/index.js:104:7)
14:32:46 api | at Module.load (internal/modules/cjs/loader.js:1000:32)
14:32:46 api | at Function.Module._load (internal/modules/cjs/loader.js:899:14)
14:32:46 api | at Module.require (internal/modules/cjs/loader.js:1040:19)
14:32:46 api | at require (internal/modules/cjs/helpers.js:72:18)
error Command failed with exit code 1.
info Visit [https://yarnpkg.com/en/docs/cli/run](https://yarnpkg.com/en/docs/cli/run) for documentation about this command.
14:32:46 api | cd /Users/tobias/Library/Mobile\ Documents/com~apple~CloudDocs/Web/redwoodblog/api && yarn dev-server exited with code 1

@thedavidprice
Copy link
Contributor

@turbotobias Thank you for this and I’ll dig in. The current Redwood release uses Prisma preview.025. We have Prisma beta.2 working in our ‘master’ but yet to be released — my current working theory is that the fix is in there.

re: Global Prisma install: Ah, this could definitely be part of the issue. Did you install globally prior to trying out Redwood? Or in attempt to get things working with Redwood?

@turbotobias
Copy link

Looking forward to the release :)

Yes, most likely I had the Prisma2 CLI (alpha version) installed prior to trying out Redwood the first time. But same result after uninstalling npm uninstall -g @prisma/cli --save, but not sure if that cleans everything? I did clear the rm -rf ~/.cache/prisma also with same results.

@AndrewSverdrup
Copy link
Author

@thedavidprice I can also still reproduce the issue following the steps you listed. I also had the Prisma2 CLI installed globally before trying out Redwood, so it sounds like that may be the issue. I tried uninstalling the CLI, but it doesn't fix the issue. Also I'm on a Mac, not sure if that makes a difference.

Looking forward to the release :)

Me too!

@peterp
Copy link
Contributor

peterp commented Apr 11, 2020

Could you run the following and let us know if it generates the client, and migrates the database?

cd <myproject>/api
yarn prisma2 migrate up --experimental --create-db
yarn prisma2 generate

This is equivalent to what is run when you type yarn rw db up

@turbotobias
Copy link

  1. Running$ yarn prisma2 migrate up --experimental --create-db (from /api) errors the following
yarn run v1.21.1
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/prisma2' migrate up --experimental --create-db
Error: Get config {"is_panic":false,"message":"error: Environment variable not found: BINARY_TARGET.\n  -->  schema.prisma:8\n   | \n 7 |   provider      = \"prisma-client-js\"\n 8 |   binaryTargets = env(\"BINARY_TARGET\")\n   | \n\nValidation Error Count: 1","meta":{"full_error":"error: Environment variable not found: BINARY_TARGET.\n  -->  schema.prisma:8\n   | \n 7 |   provider      = \"prisma-client-js\"\n 8 |   binaryTargets = env(\"BINARY_TARGET\")\n   | \n\nValidation Error Count: 1"},"error_code":"P1012"}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@turbotobias
Copy link

Same error for yarn prisma2 generate 👆

Tried yarn rw db up for funsies and it migrates the database but fails to set up client, "cannot call write after stream was destroyed".

Output

tobias@Tobiass-MacBook-Pro api % yarn rw db up
yarn run v1.21.1
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/rw' db up
Migrate database up... [started]
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/prisma2' migrate up --experimental --create-db
🏋️‍  migrate up

All migrations are already applied
Migrate database up... [completed]
Generating the Prisma client... [started]
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/prisma2' generate
Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Generating the Prisma client... [failed]
→ Command failed with exit code 1: yarn prisma2 generate
Command failed with exit code 1: yarn prisma2 generate
✨  Done in 3.65s.

@peterp
Copy link
Contributor

peterp commented Apr 11, 2020

@turbotobias Crazy, could you check that your .env.defaults has the BINARY_TARGETS line:

https://github.com/redwoodjs/create-redwood-app/blob/master/.env.defaults#L7

@turbotobias
Copy link

Yup, file matches exactly

# These environment variables will be used by default if you do not create any
# yourself in .env. This file should be safe to check into your version control
# system. Any custom values should go in .env and .env should *not* be checked
# into version control.

DATABASE_URL=file:./dev.db
BINARY_TARGET=native

@peterp
Copy link
Contributor

peterp commented Apr 11, 2020

Thanks, this gives me an idea! I'll get back to you soon

@turbotobias
Copy link

Just out of curiosity, how is yarn prisma2 ... supposed to work without any prisma2 command? I can't seem to find it in any of the package.json's or in the @redwoodjs repo

@peterp
Copy link
Contributor

peterp commented Apr 11, 2020

Check node_modules/.bin

~/Downloads/redwoodblog
➜ ls node_modules/.bin/prisma2
node_modules/.bin/prisma2

The package is installed here:

"@redwoodjs/cli": "^0.4.0",

@peterp
Copy link
Contributor

peterp commented Apr 11, 2020

@turbotobias So I actually forgot how the yarn rw db generate command works 🤦‍♂️. It loads in the environmental variables defined in `.env:

config({
path: path.join(getPaths().base, '.env'),
encoding: 'utf8',
defaults: path.join(getPaths().base, '.env.defaults'),
})

and then passes them in scope to the executed CLI:

extendEnv: true,

Could you just run yarn rw db generate?

@turbotobias
Copy link

Yes, yarn rw db generate produces

tobias@Tobiass-MacBook-Pro redwoodblog % yarn rw db generate
yarn run v1.21.1
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/rw' db generate
Generating the Prisma client... [started]
$ '/Users/tobias/Library/Mobile Documents/com~apple~CloudDocs/Web/redwoodblog/node_modules/.bin/prisma2' generate
Error: Cannot call write after a stream was destroyed
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Generating the Prisma client... [failed]
→ Command failed with exit code 1: yarn prisma2 generate
Command failed with exit code 1: yarn prisma2 generate
✨  Done in 3.28s.

@Rosenberg96
Copy link
Contributor

Hi @turbotobias,

See this issue: prisma/prisma#1973
From your console output here it seems that the path Mobile Documents includes space. I suggest trying from a new system path

@thedavidprice
Copy link
Contributor

The “space in path” issue above is very helpful. But this doesn’t seem to be the case for the OP @AndrewSverdrup (make sure to click the details hide/reveal): #404 (comment)

There are a couple other data points for diagnosing:

We have a yarn rw info command, which uses envinfo package. Potentially we could add a check here for globally installed packages. However, since we use yarn it won’t pick up npm installed global packages. (Based on my local tests.)

As of now, I think 2/3 of the reported errors will resolve once we release new Redwood packages that include the latest Prisma beta. (Hopefully this Monday 🤞 )

@turbotobias
Copy link

turbotobias commented Apr 11, 2020

Hi @turbotobias,

See this issue: prisma/prisma#1973
From your console output here it seems that the path Mobile Documents includes space. I suggest trying from a new system path

Early on I looked at that issue and thought "I don't have spaces in my paths"... 🤦 But totally forgot that the Mac OS 10.15.* update raped my filesystem. It put common folders like Documents and similar undeneath this new "Mobile Documents" folder which is iCloud. So possible that others on recent Mac OS versions may experience the same.

Anyways, now the client is generated and everything is working (using another path without spaces) ✅

Thanks! 🙏

@AndrewSverdrup
Copy link
Author

The space in the path was my issue too. I didn't realize that could be the cause of the issue and I sort of "sanitized" the path in the output logs I posted since the path to my project was fairly long. Never thought that'd be the issue 🤦. Thanks for the fix and I've learned not to modify the output log at all (seems obvious now 😅).

@turbotobias
Copy link

The space in the path was my issue too. I didn't realize that could be the cause of the issue and I sort of "sanitized" the path in the output logs I posted since the path to my project was fairly long. Never thought that'd be the issue 🤦. Thanks for the fix and I've learned not to modify the output log at all (seems obvious now 😅).

That is so funny that you made the path pretty. I did exactly the same in my first log reply, thankfully I added more without modifying. Never again!

@thedavidprice
Copy link
Contributor

Looks like a fix is now merged into prisma/cli@alpha and will be in next Beta release:
prisma/prisma#1973

@thedavidprice
Copy link
Contributor

This was reported earlier on Windows. Linking to test as well once next Prisma release is out and in RWJS: #409

@thedavidprice thedavidprice added bug/confirmed We have confirmed this is a bug and removed bug/repro-available A reproduction exists and needs to be confirmed labels Apr 18, 2020
@InquisitiveAboutReact
Copy link

Hi - As per the documentation, we need yarn > 1.15 and node > 12.x to bootstrap your RW app. I have yarn 1.22.10 and node 12.18.4 but I am getting the following error when I am trying to exec < yarn create redwood app {appname} >
Could anyone confirm if I need Node v > 14 ?
image

@Tobbe
Copy link
Member

Tobbe commented Jun 13, 2021

@InquisitiveAboutReact We fairly recently decided to tighten up our node requirement. We only run tests on node 14.x, so we decided that was the only version we wanted to officially support. If our docs still say >= 12 somewhere, they need to be updated. Do you by chance still remember where you read node 12?

If you want to continue using RW on node 12 you have to manually change the "engines" config in the root package.json file. But, again, since we're not testing on node 12 any more, there are no guarantees that it'll work, so you have to test yourself.

@InquisitiveAboutReact
Copy link

InquisitiveAboutReact commented Jun 13, 2021

Hi @Tobbe - Thanks for your reply. To answer your question 'Do you by chance still remember where you read node 12? ' -- Today is my first day exploring RW and went through the below URL. In Video 1 , it says Yarn > 1.15.x and Node > 12.x
_https://learn.redwoodjs.com/docs/tutorial/welcome-to-redwood/

Last but not the least, while creating the RW app , using yarn create redwood-app ./appname , I am getting the below message .. The app folder gets created and while I was trying to run yarn redwood dev or yarn rw dev it says it couldn't find the command 'redwood' / 'rw' . Sorry for too many questions, I must be missing something I guess :)
image

@InquisitiveAboutReact
Copy link

Hi @Tobbe - Somehow able to fix the issue. Below are the steps I did

  1. Manually fix the node version in root package.json
  2. after creating RW app, I triggered the command ' yarn install ' ( not mentioned in the doc I believe. It should be added )
  3. Ran the command yarn rw dev to bootstrap my app.
    However there are some errors I got related to Prisma , will try to fix it.
    Cheers !!

@Tobbe
Copy link
Member

Tobbe commented Jun 13, 2021

2. after creating RW app, I triggered the command ' yarn install ' ( not mentioned in the doc I believe. It should be added )

You only had to do that because it failed in the first step. For someone who already had the required version of node RW will be installed automatically

@Tobbe
Copy link
Member

Tobbe commented Jun 13, 2021

Today is my first day exploring RW and went through the below URL. In Video 1 , it says Yarn > 1.15.x and Node > 12.x

Ahh, I see.
The videos are pretty old by now. A lot has changed since they were recorded 🙂 Until new videos are produced (which is a lot of work!) I'd recommend you follow the written tutorial instead. It's much more up to date

@InquisitiveAboutReact
Copy link

I will do the same. Thanks for your reply @Tobbe . One more query though. Getting the below error, any suggestion for a quick fix for the same? It's related to Prisma.
image

@dthyresson
Copy link
Contributor

dthyresson commented Jun 13, 2021

If our docs still say >= 12 somewhere, they need to be updated. Do you by chance still remember where you read node 12?

@Tobbe I think is is in the Quick Start https://redwoodjs.com/docs/quick-start

image

Have added a documentation issue: https://github.com/redwoodjs/redwoodjs.com/issues/717

@Tobbe
Copy link
Member

Tobbe commented Jun 13, 2021

One more query though. Getting the below error, any suggestion for a quick fix for the same? It's related to Prisma.

I'm afraid I haven't seen that one before 🙁

Could you please try upgrading to node 14 if you haven't already? See if that helps

BTW, what shell and terminal are you using?

@InquisitiveAboutReact
Copy link

Hi @Tobbe - I am using command prompt and Node js command prompt. There's one solution provided in the below Github link but looks like it's old. I tried to search ../node_modules/prisma2 folder but didn't get it.
#215

Oh, the system currently I am working on, it's a bit old so don't support N v 14. Thought I'd try with N v 13.x but haven't started yet. If you somehow managed to find the solution, please do let me know.

@Tobbe
Copy link
Member

Tobbe commented Jun 13, 2021

Can you please post the output from yarn rw info? Thanks!

@InquisitiveAboutReact
Copy link

@Tobbe
image

@Tobbe
Copy link
Member

Tobbe commented Jun 13, 2021

I was hoping to get the full output, to see your Windows version as well

Here's mine

$ yarn rw info
yarn run v1.22.4
$ C:\Users\tobbe\dev\redwood\performance-management\node_modules\.bin\rw info

  System:
    OS: Windows 10 10.0.19041
  Binaries:
    Node: 16.3.0 - ~\AppData\Local\Temp\yarn--1623628382025-0.26088926523178935\node.CMD
    Yarn: 1.22.4 - ~\AppData\Local\Temp\yarn--1623628382025-0.26088926523178935\yarn.CMD
  Browsers:
    Chrome: 91.0.4472.101
    Edge: Spartan (44.19041.1023.0), Chromium (91.0.864.48)
  npmPackages:
    @redwoodjs/core: ^0.33.3 => 0.33.3

Done in 9.41s.

@InquisitiveAboutReact
Copy link

Hi @Tobbe - Here's the full log. This system of mine is kinda old where I am trying to work on RW. It's Win 7.
image

@Tobbe
Copy link
Member

Tobbe commented Jun 14, 2021

Yeah, sorry, if things works on something that old it's more of a happy coincidence than something we have the resources to actively support.

But, if there's some easy change we can do to make it work for you, we're happy to fix it 🙂 Just let us know 👍

@InquisitiveAboutReact
Copy link

InquisitiveAboutReact commented Jun 14, 2021

Hi @Tobbe - Thanks a lot for your help till now. Really appreciate :)
I have tried , well have been trying in different ways but still getting the Prisma error. Tried installing prisma cli and client separately inside ../api but didn't work out. Also getting error whenever I am running yarn rw prisma migrate dev
Not sure is this as I am working on Win 7 or not but my guess is may be this is due to the OS version. Unfortunately this issue makes me stall from moving forward :(

@Tobbe
Copy link
Member

Tobbe commented Jun 14, 2021

@InquisitiveAboutReact Is it 32 or 64 bit Win7? I just found this prisma/prisma#6771

@InquisitiveAboutReact
Copy link

@Tobbe -Thanks, went through the thread. It's for query-engine and Microsoft has ended the support for W7. When I try to install prisma/cli , prisma/client locally / globally, I am not having any issues. When redwood is trying to run prisma client, I am getting error, so I believe it might be something related to configuration related to Redwood + Prisma for Win7. Don't think it's an isolated incident only related to prisma. What's your take on this? I think, I should post this issue in prisma github forum as well.

@Tobbe
Copy link
Member

Tobbe commented Jun 14, 2021

It's for query-engine and Microsoft has ended the support for W7

Exactly! I remembered seeing query-engine-windows.exe in your screenshot. And since you're on Win7 I thought it might be relevant to you :)

image

You can ask the Prisma people, but I think they're just going to tell you the same thing as the dude in that issue I linked - Win7 is not supported.

@InquisitiveAboutReact
Copy link

Yes I saw that and you did catch it perfectly @Tobbe :) Posted that issue in Prisma forum. Let's see. Doing manual configuration for Win 7 will be hectic still will try once if needed. Let's hope for the best !

@InquisitiveAboutReact
Copy link

They have requested to log this as a bug . Below is the link
prisma/prisma#7660

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed We have confirmed this is a bug topic/prisma
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants