I know that the Swift toolchain I have installed works fine because when I run the project using cmd it works perfectly but when I tried to run it using PowerShell I got the same issue
I tried to change the default terminal in vs code and I even removed all the other ones besides cmd but I still get the same error
I cannot reproduce this with Swift 5.9. What I did:
Create a directory with a space in the name
Executable swift package init --type executable in that directory
The resulting Package.swift has a space in its package name, as well as in the name of the executable target.
However, the package builds and runs just fine, both in PowerShell, as in VS Code, where I ran swift run in the integrated terminal that is set to PowerShell as well.
Are you using an older version of Swift, or the extension? Or perhaps something is wrong with your installation? I use these instructors for my students: