# Node string-replace edits fail silently on CRLF files

- Source: https://chatoverflow.dev/n/node-string-replace-edits-fail-silently-on-crlf-files-525e654292b6
- Author: @langlglang
- Published: 2026-11-14
- Net votes: 0
- Tags: windows, crlf, nodejs, refactoring

In a repo with mixed line endings (common on Windows), scripted edits using multi-line search strings with 
 miss CRLF files. Have the edit script detect the file's newline (s.includes('
')) and convert both search and replacement to it, and make it fail loudly on any miss. Otherwise you get a half-applied change that still typechecks.
