Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on "flutter gen-l10n" #145112

Closed
sahilmahi opened this issue Mar 13, 2024 · 6 comments
Closed

Error on "flutter gen-l10n" #145112

sahilmahi opened this issue Mar 13, 2024 · 6 comments
Labels
team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds

Comments

@sahilmahi
Copy link

sahilmahi commented Mar 13, 2024

Since version 3.19.0 i'm getting an error on command: "flutter gen-l10n".
I've been waiting for months for the fix to be released on stable.

image

command

flutter gen-l10n

exception

PathNotFoundException: PathNotFoundException: Cannot open file, path = 'pubspec.yaml' (OS Error: Impossibile trovare il file specificato.
, errno = 2)

#0      _File.throwIfError (dart:io/file_impl.dart:675:7)
#1      _File.openSync (dart:io/file_impl.dart:490:5)
#2      _File.readAsBytesSync (dart:io/file_impl.dart:574:18)
#3      _File.readAsStringSync (dart:io/file_impl.dart:624:18)
#4      ForwardingFile.readAsStringSync (package:file/src/forwarding/forwarding_file.dart:99:16)
#5      ErrorHandlingFile.readAsStringSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:217:22)
#6      _runSync (package:flutter_tools/src/base/error_handling_io.dart:587:14)
#7      ErrorHandlingFile.readAsStringSync (package:flutter_tools/src/base/error_handling_io.dart:216:12)
#8      generateLocalizations (package:flutter_tools/src/localizations/gen_l10n.dart:51:56)
#9      GenerateLocalizationsCommand.runCommand (package:flutter_tools/src/commands/generate_localizations.dart:264:11)
#10     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1765:12)
<asynchronous suspension>
#11     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1389:27)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#13     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#14     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:355:9)
<asynchronous suspension>
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#16     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:295:5)
<asynchronous suspension>
#17     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:119:9)
<asynchronous suspension>
#18     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#19     main (package:flutter_tools/executable.dart:90:3)
<asynchronous suspension>

Expected results

generation of localization files

Flutter Doctor output

[√] Flutter (Channel stable, 3.19.3, on Microsoft Windows [Versione 10.0.22631.3155], locale it-IT)
• Flutter version 3.19.3 on channel stable at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision ba39319 (6 days ago), 2024-03-07 15:22:21 -0600
• Engine revision 2e4ba9c6fb
• Dart version 3.3.1
• DevTools version 2.31.1

[√] Windows Version (Installed version of Windows is version 10 or higher)

[!] Android toolchain - develop for Android devices (Android SDK version 33.0.1)
• Android SDK at C:\Users\STB010\AppData\Local\Android\sdk
X cmdline-tools component is missing
Run path/to/sdkmanager --install "cmdline-tools;latest"
See https://developer.android.com/studio/command-line for more details.
X Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web
• Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Professional 2022 17.8.5)
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Professional
• Visual Studio Professional 2022 version 17.8.34511.84
• Windows 10 SDK version 10.0.19041.0

[√] Android Studio (version 2021.3)
• Android Studio at C:\Program Files\Android\Android Studio1
• Flutter plugin can be installed from:
https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[√] VS Code (version 1.87.2)
• VS Code at C:\Users\STB010\AppData\Local\Programs\Microsoft VS Code
• Flutter extension version 3.84.0

[√] Connected device (3 available)
• Windows (desktop) • windows • windows-x64 • Microsoft Windows [Versione 10.0.22631.3155]
• Chrome (web) • chrome • web-javascript • Google Chrome 122.0.6261.112
• Edge (web) • edge • web-javascript • Microsoft Edge 122.0.2365.80

[√] Network resources
• All expected network resources are available.

@huycozy huycozy added the in triage Presently being triaged by the triage team label Mar 14, 2024
@huycozy
Copy link
Member

huycozy commented Mar 14, 2024

Looking at the stack trace, the error seems to come from:

final bool useCRLF = fileSystem.file('pubspec.yaml').readAsStringSync().contains('\r\n');

This has been changed since #141233 landed. Could you switch to beta/master channel to see if it fixed on your end?

flutter channel master
flutter upgrade

@huycozy huycozy added the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 14, 2024
@sahilmahi
Copy link
Author

sahilmahi commented Mar 28, 2024

I tried on beta and master channel but not working... same error.

[√] Flutter (Channel beta, 3.21.0-1.0.pre.2, on Microsoft Windows [Versione 10.0.22631.3296], locale it-IT)
• Flutter version 3.21.0-1.0.pre.2 on channel beta at C:\src\flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision c398442 (2 weeks ago), 2024-03-12 22:26:24 -0700
• Engine revision 0d4f78c952
• Dart version 3.4.0 (build 3.4.0-190.1.beta)
• DevTools version 2.33.1

PathNotFoundException: PathNotFoundException: Cannot open file, path = 'C:\Users\STB010\Documents\GitHub\bancass_fe\lib\l10n\application\pubspec.yaml' (OS Error: Impossibile trovare il file specificato.
, errno = 2)

#0      _File.throwIfError (dart:io/file_impl.dart:675:7)
#1      _File.openSync (dart:io/file_impl.dart:490:5)
#2      _File.readAsBytesSync (dart:io/file_impl.dart:574:18)
#3      _File.readAsStringSync (dart:io/file_impl.dart:624:18)
#4      ForwardingFile.readAsStringSync (package:file/src/forwarding/forwarding_file.dart:99:16)
#5      ErrorHandlingFile.readAsStringSync.<anonymous closure> (package:flutter_tools/src/base/error_handling_io.dart:217:22)
#6      _runSync (package:flutter_tools/src/base/error_handling_io.dart:587:14)
#7      ErrorHandlingFile.readAsStringSync (package:flutter_tools/src/base/error_handling_io.dart:216:12)
#8      generateLocalizations (package:flutter_tools/src/localizations/gen_l10n.dart:51:61)
#9      GenerateLocalizationsCommand.runCommand (package:flutter_tools/src/commands/generate_localizations.dart:264:11)
#10     FlutterCommand.verifyThenRunCommand (package:flutter_tools/src/runner/flutter_command.dart:1758:12)
<asynchronous suspension>
#11     FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1394:27)
<asynchronous suspension>
#12     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#13     CommandRunner.runCommand (package:args/command_runner.dart:212:13)
<asynchronous suspension>
#14     FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:360:9)
<asynchronous suspension>
#15     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#16     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:300:5)
<asynchronous suspension>
#17     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:119:9)
<asynchronous suspension>
#18     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:153:19)
<asynchronous suspension>
#19     main (package:flutter_tools/executable.dart:94:3)
<asynchronous suspension>

@github-actions github-actions bot removed the waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds label Mar 28, 2024
@huycozy
Copy link
Member

huycozy commented Mar 29, 2024

Thanks for checking, keeping the issue open for further insights. Meanwhile, could you confirm this issue on a new Flutter project?

@huycozy huycozy added tool Affects the "flutter" command-line tool. See also t: labels. team-tool Owned by Flutter Tool team waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds and removed in triage Presently being triaged by the triage team labels Mar 29, 2024
@hayesOw
Copy link

hayesOw commented Apr 3, 2024

Hi I was experiencing this issue on flutter 3.19.5, upgrading to the beta 3.21.0-0.0.pre fixed the issue but that version has a lot of graphical issues. I had to downgrade to 3.13.9 to get a working build

Copy link

Without additional information, we are unfortunately not sure how to resolve this issue. We are therefore reluctantly going to close this bug for now.
If you find this problem please file a new issue with the same description, what happens, logs and the output of 'flutter doctor -v'. All system setups can be slightly different so it's always better to open new issues and reference the related ones.
Thanks for your contribution.

Copy link

github-actions bot commented May 3, 2024

This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
team-tool Owned by Flutter Tool team tool Affects the "flutter" command-line tool. See also t: labels. waiting for customer response The Flutter team cannot make further progress on this issue until the original reporter responds
Projects
None yet
Development

No branches or pull requests

3 participants