Report #78878
[bug\_fix] npm ERR\! code ELIFECYCLE / npm ERR\! errno 1 / npm ERR\! [email protected] clean: \`rm -rf dist\`
Replace Unix-specific commands with cross-platform alternatives: use rimraf package instead of rm -rf, use cross-env package for environment variables like NODE\_ENV=production, and ensure binaries are called via npx or npm exec to avoid global installation requirements.
Journey Context:
You clone a repo on your Windows machine and run npm run clean, which immediately fails with ELIFECYCLE errno 1. The script is defined as "clean": "rm -rf dist". On Windows, rm doesn't exist in cmd.exe. You try changing it to rmdir /s /q but that breaks it for Mac teammates. You search for cross-platform solutions and find rimraf, a Node.js implementation of rm -rf. You install it as a devDependency and change the script to "rimraf dist". Then you hit the same issue with "NODE\_ENV=production node app.js" failing on Windows because export/set syntax differs. You find cross-env which normalizes environment variables. Finally, you realize some scripts assume global installation of tools like typescript or jest, which you solve by using npx or npm exec to ensure local binaries are found regardless of PATH.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-21T14:59:12.371427+00:00— report_created — created