kool-dev / kool

From local development to the cloud: web apps development with containers made easy.
https://kool.dev
MIT License
667 stars 45 forks source link

failed to run cp .env.example .env error: command not found #393

Closed daniel-waiguru closed 1 year ago

daniel-waiguru commented 3 years ago

Getting this error while trying to run kool run setup on windows machine freshly created laravel project failed to run cp .env.example .env error: command not found

Here is my kool.yml file content scripts.


scripts:
  artisan: kool exec app php artisan
  composer: kool exec app composer
  mysql: kool exec -e MYSQL_PWD=$DB_PASSWORD database mysql -u $DB_USERNAME $DB_DATABASE
  node-setup:
  - kool run npm install
  - kool run npm run dev
  npm: kool docker kooldev/node:14 npm
  npx: kool docker kooldev/node:14 npx
  phpunit: kool exec app php ./bin/phpunit
  reset:
  - kool run composer install
  - kool run artisan migrate:fresh --seed
  - kool run node-setup
  setup:
  - cp .env.example .env
  - kool start
  - kool run composer install
  - kool run artisan key:generate
  - kool run node-setup
fabriciojs commented 3 years ago

Hey @DanielWaiguru91 - sorry for the delay, failed to notice this new issue.

So we have seen other reports about this error on Windows. Unfortunately, we don't have much QA on Windows nowadays.

It's important to point out that we strongly suggest leveraging WSL2 for your Docker base development. Running kool from within a Bash certainly would work and we have a growing community using it that way, so it's battle-tested in that setup.

What you can do

While we don't track down and fix this issue on Windows, you can remove the cp from kool.yml and have that as a manual step. This is the simplest solution.

Again, we do believe that taking a crack on WSL2 could be really worthwhile.

danielsuguimoto commented 2 years ago

I guess cp is a Unix command. @fabriciojs how about replacing these non kool commands in our scripts by a kool command? We could use kooldev/bash image for that, for example

e.g.: kool docker kooldev/bash -c "cp .env.example .env"

fabriciojs commented 2 years ago

@danielsuguimoto I think this is a good way out, yes.

fabriciojs commented 1 year ago

This has been fixed as suggested above - newly installed presets will have the kooldev/bash image to run the cp - so we are platform-agnostic and make sure it will always work.