Swift error on Windows: invalidManifestFormat: Missing or empty JSON output from manifest compilation

Viewed 262

I've installed Swift 5.6.1 on my Windows 10 machine, including all the necessary Visual Studio components, but I can't seem to build anything. Even just running the following set of commands in git bash results in an error:

mkdir swiftTest
cd swiftTest
swift package init --type executable
swift build

Specifically, the swift build command gives the following errors:

warning: Failed creating default cache location, Error Domain=NSCocoaErrorDomain Code=256 "(null)"
'swiftTest': error: invalidManifestFormat("Missing or empty JSON output from manifest compilation for swiftTest", diagnosticFile: nil)

The error message seems surprisingly rare -- the top google results were the source of the program that generated that error, and an unrelated error with similar wording from a ReactJS application.
Do I just have to add some flags to the swift build command, or is there something else wrong with my setup?

1 Answers

In my case what fixed it was invoking the command from a Visual Studio Developer Command prompt.

Related