Skip to content

Fix devcontainer on Windows#2920

Open
yutamago wants to merge 1 commit intohome-assistant:masterfrom
yutamago:fix-devcontainers-on-windows
Open

Fix devcontainer on Windows#2920
yutamago wants to merge 1 commit intohome-assistant:masterfrom
yutamago:fix-devcontainers-on-windows

Conversation

@yutamago
Copy link

@yutamago yutamago commented Jan 20, 2026

Proposed change

When checking out the repository with Git for Windows with automatic line ending conversion, building the Dockerfile for the Dev Container fails with this error:

[3/3] RUN   su node -c     "source /usr/local/share/nvm/nvm.sh && nvm install $(cat /tmp/.nvmrc) 2>&1":
Version '20' not found - try `nvm ls-remote` to browse available versions.

Turns out that the .nvmrc file contains a line break that will convert to \r\n on Windows.

  • This PR removes the unnecessary line break.
  • It also adds a .gitattributes file, flagging the .nvmrc file to always convert to UNIX style line endings, to prevent this issue from carelessly re-appearing in the future.

Type of change

  • Document existing features within Home Assistant
  • Document new or changing features for which there is an existing pull request elsewhere
  • Spelling or grammatical corrections, or rewording for improved clarity
  • Changes to the backend of this documentation
  • Remove stale or deprecated documentation

Checklist

  • I have read and followed the documentation guidelines.
  • I have verified that my changes render correctly in the documentation.

Additional information

  • This PR fixes or closes issue: fixes #
  • Link to relevant existing code or pull request:

Summary by CodeRabbit

  • Chores
    • Updated Git configuration to standardize text handling and line ending normalization across the repository.
    • Updated Node version configuration file metadata.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 20, 2026

📝 Walkthrough

Walkthrough

Adds a .gitattributes file to configure automatic text handling and LF line ending enforcement for .nvmrc. Normalizes the .nvmrc file's line ending to match the configured standard.

Changes

Cohort / File(s) Summary
Git Configuration
.gitattributes
New file that enables automatic text handling for all files and enforces LF line endings specifically for .nvmrc.
Node Version Management
.nvmrc
Line ending normalized to LF, aligning with the .gitattributes configuration. Content value unchanged.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title 'Fix devcontainer on Windows' is directly related to the main objective of this PR, which addresses Dev Container build failures on Windows systems due to line ending issues.
Description check ✅ Passed The pull request description provides a clear explanation of the problem (line endings breaking nvm on Windows), the solution (removing trailing line break and adding .gitattributes), and follows the template structure with all required sections completed.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Docstrings were successfully generated.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@yutamago yutamago changed the title fix .nvmrc line endings, breaking devcontainers on Windows fix devcontainer on Windows Jan 20, 2026
@yutamago yutamago changed the title fix devcontainer on Windows Fix devcontainer on Windows Jan 20, 2026
@home-assistant home-assistant deleted a comment from coderabbitai bot Jan 23, 2026
@silamon silamon requested a review from Copilot March 2, 2026 17:59
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes Dev Container builds on Windows (with Git for Windows autocrlf) by preventing CRLF conversion from breaking nvm install when reading .nvmrc.

Changes:

  • Normalize .nvmrc contents to avoid CRLF-related version parsing issues.
  • Add .gitattributes to enforce LF line endings for .nvmrc (and set repo-wide text=auto).

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated 2 comments.

File Description
.nvmrc Ensures the Node version file is a single clean line (20) to avoid CRLF-related parsing failures.
.gitattributes Adds Git attributes to keep .nvmrc checked out with LF line endings to prevent the issue from recurring.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1 to +4
# Auto detect text files and perform LF normalization
* text=auto

# Always use linux style line endings
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

* text=auto applies attributes repo-wide, not just to .nvmrc. If the intent here is only to prevent CRLF in .nvmrc, consider limiting .gitattributes to that file to minimize global behavior changes.

Suggested change
# Auto detect text files and perform LF normalization
* text=auto
# Always use linux style line endings
# Ensure .nvmrc always uses LF (Unix) line endings

Copilot uses AI. Check for mistakes.
# Auto detect text files and perform LF normalization
* text=auto

# Always use linux style line endings
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The comment says "Always use linux style line endings", but this rule only targets .nvmrc. Consider updating the comment for accuracy (and capitalize "Linux").

Suggested change
# Always use linux style line endings
# Use Linux-style line endings for .nvmrc

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants