redwood: Unable to clone repo and work on redwood app

So I’m following the tutorial and was able to upgrade to Redwood 0.8.2 after having issues with 0.8.0. However, I wanted to update the same project based on the tutorial on my other computer. When I clone the repository and run yarn && yarn rw dev, I get the following errors:

yarn run v1.22.4
$ /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.bin/rw dev
$ /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.bin/dev-server
$ /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.bin/prisma generate --watch
$ /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.bin/webpack-dev-server --config ../node_modules/@redwoodjs/core/config/webpack.development.js
22:54:46 api | Running at 'http://localhost:8911'
22:54:46 api | Watching files in '/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api/src/functions'
22:54:47 api | /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.prisma/client/index.js:3
22:54:47 api |     throw new Error(
22:54:47 api |     ^
22:54:47 api | 
22:54:47 api | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
22:54:47 api | In case this error is unexpected for you, please report it in https://github.com/prisma/prisma-client-js/issues/390.
22:54:47 api |     at new PrismaClient (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.prisma/client/index.js:3:11)
22:54:47 api |     at Object.<anonymous> (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api/src/lib/db.js:6:19)
22:54:47 api |     at Module._compile (internal/modules/cjs/loader.js:1158:30)
22:54:47 api |     at Module._compile (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/pirates/lib/index.js:99:24)
22:54:47 api |     at Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
22:54:47 api |     at Object.newLoader [as .js] (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/pirates/lib/index.js:104:7)
22:54:47 api |     at Module.load (internal/modules/cjs/loader.js:1002:32)
22:54:47 api |     at Function.Module._load (internal/modules/cjs/loader.js:901:14)
22:54:47 api |     at Module.require (internal/modules/cjs/loader.js:1044:19)
22:54:47 api |     at require (internal/modules/cjs/helpers.js:77:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
22:54:47 api | cd "/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api" && yarn dev-server exited with code 1
22:54:47 api | cd "/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api" && yarn dev-server restarted
22:54:47 web | ℹ 「wds」: Project is running at http://localhost:8910/
22:54:47 web | ℹ 「wds」: webpack output is served from /
22:54:47 web | ℹ 「wds」: Content not from webpack is served from /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/web
22:54:47 web | ℹ 「wds」: 404s will fallback to /index.html
$ /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.bin/dev-server
22:54:47  db | 
22:54:47  db | Watching... /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api/
22:54:47  db | prisma/schema.prisma
22:54:47  db | 
22:54:47  db | Get config {"is_panic":false,"message":"error: Environment variable not found: B
22:54:47  db | INARY_TARGET.\n  -->  schema.prisma:8\n   | \n 7 |   provider      = \"prisma-cl
22:54:47  db | ient-js\"\n 8 |   binaryTargets = env(\"BINARY_TARGET\")\n   | \n\nValidation Er
22:54:47  db | ror Count: 1","meta":{"full_error":"error: Environment variable not found: BINAR
22:54:47  db | Y_TARGET.\n  -->  schema.prisma:8\n   | \n 7 |   provider      = \"prisma-client
22:54:47  db | -js\"\n 8 |   binaryTargets = env(\"BINARY_TARGET\")\n   | \n\nValidation Error 
22:54:47  db | Count: 1"},"error_code":"P1012"}
22:54:47  db | 
22:54:47  db | 
22:54:47 api | Running at 'http://localhost:8911'
22:54:47 api | Watching files in '/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api/src/functions'
22:54:49 api | /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.prisma/client/index.js:3
22:54:49 api |     throw new Error(
22:54:49 api |     ^
22:54:49 api | 
22:54:49 api | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
22:54:49 api | In case this error is unexpected for you, please report it in https://github.com/prisma/prisma-client-js/issues/390.
22:54:49 api |     at new PrismaClient (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.prisma/client/index.js:3:11)
22:54:49 api |     at Object.<anonymous> (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api/src/lib/db.js:6:19)
22:54:49 api |     at Module._compile (internal/modules/cjs/loader.js:1158:30)
22:54:49 api |     at Module._compile (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/pirates/lib/index.js:99:24)
22:54:49 api |     at Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
22:54:49 api |     at Object.newLoader [as .js] (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/pirates/lib/index.js:104:7)
22:54:49 api |     at Module.load (internal/modules/cjs/loader.js:1002:32)
22:54:49 api |     at Function.Module._load (internal/modules/cjs/loader.js:901:14)
22:54:49 api |     at Module.require (internal/modules/cjs/loader.js:1044:19)
22:54:49 api |     at require (internal/modules/cjs/helpers.js:77:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
22:54:49 api | cd "/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api" && yarn dev-server exited with code 1
22:54:49 api | cd "/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api" && yarn dev-server restarted
$ /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.bin/dev-server
22:54:49 api | Running at 'http://localhost:8911'
22:54:49 api | Watching files in '/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api/src/functions'
22:54:50 api | /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.prisma/client/index.js:3
22:54:50 api |     throw new Error(
22:54:50 api |     ^
22:54:50 api | 
22:54:50 api | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
22:54:50 api | In case this error is unexpected for you, please report it in https://github.com/prisma/prisma-client-js/issues/390.
22:54:50 api |     at new PrismaClient (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.prisma/client/index.js:3:11)
22:54:50 api |     at Object.<anonymous> (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api/src/lib/db.js:6:19)
22:54:50 api |     at Module._compile (internal/modules/cjs/loader.js:1158:30)
22:54:50 api |     at Module._compile (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/pirates/lib/index.js:99:24)
22:54:50 api |     at Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
22:54:50 api |     at Object.newLoader [as .js] (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/pirates/lib/index.js:104:7)
22:54:50 api |     at Module.load (internal/modules/cjs/loader.js:1002:32)
22:54:50 api |     at Function.Module._load (internal/modules/cjs/loader.js:901:14)
22:54:50 api |     at Module.require (internal/modules/cjs/loader.js:1044:19)
22:54:50 api |     at require (internal/modules/cjs/helpers.js:77:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
22:54:50 api | cd "/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api" && yarn dev-server exited with code 1
22:54:50 api | cd "/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api" && yarn dev-server restarted
$ /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.bin/dev-server
22:54:51 api | Running at 'http://localhost:8911'
22:54:51 api | Watching files in '/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api/src/functions'
22:54:52 api | /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.prisma/client/index.js:3
22:54:52 api |     throw new Error(
22:54:52 api |     ^
22:54:52 api | 
22:54:52 api | Error: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
22:54:52 api | In case this error is unexpected for you, please report it in https://github.com/prisma/prisma-client-js/issues/390.
22:54:52 api |     at new PrismaClient (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.prisma/client/index.js:3:11)
22:54:52 api |     at Object.<anonymous> (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api/src/lib/db.js:6:19)
22:54:52 api |     at Module._compile (internal/modules/cjs/loader.js:1158:30)
22:54:52 api |     at Module._compile (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/pirates/lib/index.js:99:24)
22:54:52 api |     at Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
22:54:52 api |     at Object.newLoader [as .js] (/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/pirates/lib/index.js:104:7)
22:54:52 api |     at Module.load (internal/modules/cjs/loader.js:1002:32)
22:54:52 api |     at Function.Module._load (internal/modules/cjs/loader.js:901:14)
22:54:52 api |     at Module.require (internal/modules/cjs/loader.js:1044:19)
22:54:52 api |     at require (internal/modules/cjs/helpers.js:77:18)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
22:54:52 api | cd "/home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/api" && yarn dev-server exited with code 1
22:54:54 web | [HPM] Error occurred while trying to proxy request /graphql from localhost:8910 to http://localhost:8911 (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)

Which looks to me like there are mostly issues with the database. So I’ve tried yarn rw db save and I get the following:

yarn run v1.22.4
$ /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.bin/rw db save
Creating database migration... [started]
$ /home/davidrhoderick/Development/redwoodjs-tutorial/redwoodblog/node_modules/.bin/prisma migrate save --experimental
Error: Get config {"is_panic":false,"message":"error: Environment variable not found: DATABASE_URL.\n  -->  schema.prisma:3\n   | \n 2 |   provider = \"sqlite\"\n 3 |   url      = env(\"DATABASE_URL\")\n   | \n\nValidation Error Count: 1","meta":{"full_error":"error: Environment variable not found: DATABASE_URL.\n  -->  schema.prisma:3\n   | \n 2 |   provider = \"sqlite\"\n 3 |   url      = env(\"DATABASE_URL\")\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.
Creating database migration... [failed]
→ Command failed with exit code 1: yarn prisma migrate save --experimental
Command failed with exit code 1: yarn prisma migrate save --experimental
Done in 2.67s.

So it looks like the .env is needed, but it should explicitly not be a part of a repo and is ignored in the .gitignore file. What is then the way to work on a project in a git repo? Shouldn’t there perhaps be a way to re-create a .env in a cloned repo?

About this issue

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

Most upvoted comments

Huh, you definitely have your marbles and when I tried the same thing, it did indeed work.

My only thought is if .env.defaults was added between 0.7.0 and 0.8.2 but even my .gitignore didn’t explicitly ignore .env.defaults (it only ignored .env).

So I’ll close this because it’s working now but it is odd and hopefully just a one-off. Thanks for all your help!

@cannikin You are the man! That’s the ticket!

I actually created the .env.defaults file as per your suggestion and then decided to run yet again git clean -fxd, which removed that file, then I ran yarn, yarn rw db up, and yarn rw dev. So is it a good idea to unignore the .env.defaults in the repo at least so it can be rebuilt without too much of this hassle? I leave that up to you. But I do concur that .env needs to be ignored…