Posts

Showing posts from February, 2026
Cross-Platform npm Scripts: Why Your Windows Commands Fail on macOS/Linux (and How to Fix Them) As developers, we often work in teams with mixed operating systems—some on Windows, others on macOS or Linux. When you're building a React application or any Node.js project, you'll inevitably encounter a frustrating problem: npm scripts that work perfectly on your Windows machine suddenly break when your teammate on macOS tries to run them. The culprit? Platform-specific environment variable syntax. While working on PixelPerfect Screenshot API , I encountered this exact issue. My npm scripts used Windows-style set VARIABLE=value && commands, which worked flawlessly in my development environment. However, this approach is fundamentally incompatible with Unix-based systems (macOS and Linux), where the set command doesn't exist in the same form. This article explores why this happens, how to fix it using cross-env , and best practices for writing truly...