serversideup / spin

🚀 Replicate your production environment locally using Docker. Just run "spin up". It's really that easy.
https://serversideup.net/open-source/spin/
GNU General Public License v3.0
1.19k stars 42 forks source link

spin init: $'\r': command not found on WSL2 #111

Open jaydrogers opened 1 week ago

jaydrogers commented 1 week ago
          I'm on 2.1.5 but still get this issue. Do we need to edit git config?
Spin Version: 
v2.1.5 [stable] (User Installed)

spin init laravel

image

UPDATE: solved by running

git config --global core.autocrlf input
git config --global core.eol lf

Originally posted by @quantumwebco in https://github.com/serversideup/spin/issues/99#issuecomment-2371012405

jaydrogers commented 1 week ago

Hey @quantumwebco,

Thanks for your help on diagnosing this issue. Although running this makes the issue go away, I'd like to make sure it's resolved automatically with Spin:

git config --global core.autocrlf input
git config --global core.eol lf

Recreating the issue

I took a Laravel Herd app and ran spin init on my WSL2 (Ubuntu 22.04) machine: https://www.dropbox.com/scl/fi/c6g321fuxa54wcx37lwht/WSL2-Install.mp4?rlkey=19o7cac1nhkafxk28nq7j27zg&st=i1bw7p56&dl=0

You can see in the video I ran into some errors, but that was be basically me missing having a running Laravel instance before cloning it down to my Windows machine. Once I set up and configured an env file I was good to go.

Am I following your steps correctly?

quantumwebco commented 1 week ago

Unfortunately I can't recreate it now. After setting the git config it just works. I even tried running

git config --global --unset core.autocrlf
git config --global --unset core.eol

However I now have a new issue

image

jaydrogers commented 1 week ago

For that error, it looks like you have some sort of volume issue on your machine.

  1. Ensure Docker Compose is running the latest stable version
  2. Run spin prune to clear all Spin cache and docker cache
  3. If the error persists and you want to start fresh, perform a possibly destructive action (backup your data first) of docker volume rm $(docker volume ls -q). This will remove ALL VOLUMES from your machine, but you can easily recreate them if you're just mounting to paths (like -v /my/local/dir:/inside/container/dir)
quantumwebco commented 1 week ago

Cool thanks for the info, will do some testing with that and come back to you. All my other docker containers and mounts seem to be working fine. It started happening after I updated to latest version for this fix https://github.com/serversideup/spin-template-laravel-basic/issues/9

jaydrogers commented 1 week ago

Thanks! Keep me posted. It could potentially be a Docker cache that will hopefully get fixed after clearing 😅🤞

quantumwebco commented 1 week ago

Hey @jaydrogers it looks like spin prune did the job. Thanks!