Skip to content

Commit 5330284

Browse files
sfshaza2loic-sharmaparlough
authored
fix: Add troubleshooting for Windows filename too long error (#12898) (#12905)
Fixes #12898. Adds a troubleshooting section to upgrade.md for the 'Filename too long' error on Windows. --------- Co-authored-by: Loïc Sharma <737941+loic-sharma@users.noreply.github.com> Co-authored-by: Parker Lougheed <parlough@gmail.com>
1 parent 42fde2f commit 5330284

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/content/install/upgrade.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,44 @@ the Dart [`pub outdated` documentation]({{site.dart-site}}/tools/pub/cmd/pub-out
167167
$ flutter pub outdated
168168
```
169169

170+
## Troubleshooting
171+
172+
### Windows: "Filename too long" error
173+
174+
When running `flutter upgrade` on Windows,
175+
you might encounter an error like the following:
176+
177+
```text
178+
error: unable to create file ...: Filename too long
179+
```
180+
181+
This occurs because the path to a file in the Flutter SDK exceeds the default
182+
maximum path length limit on Windows.
183+
184+
To resolve this issue, consider installing the Flutter SDK
185+
at a shorter path. For example, install Flutter at
186+
`C:\Flutter` instead of something longer like
187+
`C:\Users\<user name>\Documents\flutter`.
188+
189+
Otherwise, do the following:
190+
191+
1. Enable long paths support in Git:
192+
193+
```console
194+
$ git config --system core.longpaths true
195+
```
196+
197+
If the command fails with a permission error,
198+
try running your terminal as an administrator.
199+
200+
1. Enable long paths in Windows:
201+
202+
```console
203+
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
204+
```
205+
206+
This command requires administrator privileges.
207+
170208
[Flutter SDK archive]: /install/archive
171209
[flutter-announce]: {{site.groups}}/forum/#!forum/flutter-announce
172210
[pubspec.yaml]: {{site.dart-site}}/tools/pub/pubspec

0 commit comments

Comments
 (0)