-
Notifications
You must be signed in to change notification settings - Fork 30
Description
Issue: 0-byte Executable and SmartScreen Error on Windows
Victor from the Symfony Casts team suggested opening this issue for further discussion and possible improvement. I am willing to help implement potential solutions to the issue.
Summary
On Windows systems, running the tailwind:init or tailwind:build command sometimes fails due to potential interference from antivirus software (such as Avast or even Windows Defender). Instead of downloading the expected TailwindCSS executable, the process results in a 0-byte .exe file being created in the var/tailwind/ directory. When the system later attempts to execute this empty file, it triggers the Windows SmartScreen error: "This app can't run on your computer" with an "Access denied" message in the console.
Potential Root Cause
The antivirus software aggressively blocks or quarantines the executable during the download step, without any explicit warning to the user. The downloader ends up creating an empty file (0 bytes), which persists between attempts because the bundle assumes the presence of the file indicates a successful download, and does not re-download or validate its integrity.
Steps to Reproduce
- Use Windows 10 (e.g. 22H2 or higher) with active antivirus software (e.g. Windows Defender 1.1.25080.5 or higher).
- Install the bundle
composer install symfonycasts/tailwind-bundlein a new skeleton project - Attempt to run
php bin/console tailwind:initandtailwind:build. - The antivirus potentially silently blocks or breaks the download, resulting in a 0-byte
.exefile invar/tailwind/. - Subsequent attempts to run the command throw a SmartScreen error due to executing an empty file.
- Disabling or uninstalling the antivirus and deleting the broken file, then retrying, allows the download and execution to succeed.
Temporary Workaround
- Remove the bundle via composer.
- Disable antivirus software.
- Reinstall the bundle.
- Run
tailwind:initand thentailwind:buildto download the executable successfully. - Re-enable antivirus software.
Suggestions
Since this issue affects multiple users and is related to common antivirus behaviors (false positives on downloaded executables), it may be beneficial to:
- Add file size or integrity checks such as a hash digest check after download. If the binary is 0 bytes or otherwise invalid, force a re-download and display a clear error. For this the
downloadExecutable()needs to be slightly rewritten and use the GitHub API endpoint instead of downloading over the releases page, this should be changed anyway and shouldn't be too much work. - Document the issue and workaround in the README or troubleshooting guide, highlighting the need to temporarily disable antivirus or whitelist the binary download location.
- Investigate whether the download process can be made more robust against antivirus interference, or alert the user more clearly when a corrupted download is detected.
References
- Related closed issue #98
- Multiple reports from Ondrej-Vasicek, Lemin-J, and myself on the Cosmic Coding with Symfony 7 Course