Windows configuration
Disable automatic CRLF conversion
When working on Windows, by default, Git automatically converts line endings to CRLF. This can cause compatibility issues, especially in projects shared across different environments like Linux or macOS. To prevent automatic conversions, it is recommended to disable this feature in Git.
- Open a terminal
- Run the following command:
git config --global core.autocrlf false
- Additionally, make sure Git does not alter files by adding this configuration to your
.gitattributes
file:* -text
For more details, you can refer to this GitHub discussion.
Use double quotes in npm scripts
On Windows, using single quotes (’) in npm scripts can cause errors because the way single quotes are interpreted differs across systems (particularly between Windows and Linux). To ensure compatibility across all environments, it is recommended to use double quotes (") in your npm scripts.
Example of fixing this:
Incorrect (with single quotes):
"scripts": { "build": "echo 'Building the project...'" }
Correct (with double quotes):
"scripts": { "build": "echo \"Building the project...\"" }
In summary:
- Disable CRLF conversion: Configure Git to avoid automatic line-ending conversions by running
git config core.autocrlf false
and adding* -text
to your.gitattributes
file. - Use double quotes in npm scripts: Replace single quotes with double quotes to ensure script compatibility on Windows.
Following these recommendations will help avoid potential errors when running scripts and managing files on Windows environments.