Describe the bug
amplify serve fails on Windows with the following error:
Error: spawn yarn ENOENT
The amplify project was originally initialised with a Mac then cloned to Windows from a git repo.
Amplify CLI Version
4.13.1
To Reproduce
amplify serve. Reproduced on 2 different windows machines.
Expected behavior
no error
Screenshots

Desktop:
Additional context
We think it's related to npm needing .cmd on windows. See...
https://github.com/aws-amplify/amplify-cli/pull/3100/commits/aac0d8467dc38e7c7a6d2bfd7c0922a81aca2948
https://github.com/aws-amplify/amplify-cli/issues/379
https://github.com/aws-amplify/amplify-cli/issues/379
https://github.com/aws-amplify/amplify-cli/issues/1644
@alexladerman
Thanks for reporting this. Before we find a good solution to fix it, please run amplify configure project or manually change the BuildCommand and StartCommand in the amplify/.config/project-config.json file.
+1 on this issue. I'm not sure if it's a generic issue for Windows use cases or only when crossing between different operating systems.
In my case I ended up running inside WSL and cleaning up the local-env-info.json as a workaround.. in case that helps anyone else encountering this issue.
If it helps anyone else, I'm back to running directly in Windows. WSL has some pretty terrible disk I/O in my experience. The trick I didn't understand was that the BuildCommand/StartCommand need to include the .cmd suffix on them. So for example the project-config.json for me looks like:
"BuildCommand": "yarn.cmd build",
"StartCommand": "yarn.cmd start"
I'm not sure if this file has to be in source control, but if you have other team members who aren't on Windows you may want to keep this change local only.
Most helpful comment
If it helps anyone else, I'm back to running directly in Windows. WSL has some pretty terrible disk I/O in my experience. The trick I didn't understand was that the BuildCommand/StartCommand need to include the
.cmdsuffix on them. So for example theproject-config.jsonfor me looks like:I'm not sure if this file has to be in source control, but if you have other team members who aren't on Windows you may want to keep this change local only.