Dart-Code: [macOS]: failed to launch from VSCode: ArgumentError - invalid byte sequence in US-ASCII
_Issue moved from https://github.com/google/flutter-desktop-embedding/issues/586#event-2689960105_
I got this error when I was trying to launch macOS from VSCode:
Launching lib/main.dart on macOS in debug mode...
CocoaPods' output:
↳
Preparing
Analyzing dependencies
Inspecting targets to integrate
CDN: trunk Relative path: CocoaPods-version.yml exists! Returning local because checking is only perfomed in repo update
――― MARKDOWN TEMPLATE ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――――
### Command
```
/usr/local/Cellar/cocoapods/1.8.1/libexec/bin/pod install --verbose
...
ArgumentError - invalid byte sequence in US-ASCII
...
[!] Oh no, an error occurred.
Search for existing GitHub issues similar to yours:
https://github.com/CocoaPods/CocoaPods/search?q=invalid+byte+sequence+in+US-ASCII&type=Issues
If none exists, create a ticket, with the template displayed above, on:
https://github.com/CocoaPods/CocoaPods/issues/new
Be sure to first read the contributing guide for details on how to properly submit a ticket:
https://github.com/CocoaPods/CocoaPods/blob/master/CONTRIBUTING.md
Don't forget to anonymize any private data!
Looking for related issues on cocoapods/cocoapods...
- Pod Install failed
https://github.com/CocoaPods/CocoaPods/issues/9222 [open] [1 comment]
14 hours ago
- Error while setting up CocoaPods
https://github.com/CocoaPods/CocoaPods/issues/5979 [closed] [23 comments]
06 Dec 2018
- invalid byte sequence in US-ASCII
https://github.com/CocoaPods/CocoaPods/issues/1036 [closed] [9 comments]
08 Jun 2017
and 15 more at:
https://github.com/cocoapods/cocoapods/search?q=invalid%20byte%20sequence%20in%20US-ASCII&type=Issues&utf8=✓
Error output from CocoaPods:
↳
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
I have export LANG=en_US.UTF-8 in my ~/.profile and have also configured VSCode as:
{
"dart.env": {
"LANG": "en-US.UTF-8",
}
}
However, directly launch from terminal works:
flutter run -d macOS
My other targets web, ios and android work from VSCode.
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 29 (17 by maintainers)
Never mind. It’s amazing how many times you can look at something and not see the error until after you post it! Anyway, once I fixed the entry for LC_ALL in my VS Code settings.json file, then the error went away for me too.
For reference, here’s the entry in my settings.json file that is working:
Thank you @DanTup for your help with this. I am sorry for the noise.
I’m seeing this on my Mac now, so was able to do some more debugging. Here’s my understanding of the issue:
LANGetc.) because it affects how it reads filesLANGenv var is set by the terminal at startup - it is not set system-wide for programs not launched from the terminalLANGset, that results in us spawningflutter runwithout it set, and that results in CocoaPods/Ruby using ansii encoding and breaking on UTF-8The ideal fix would be “Dart-Code should just set UTF8” on all its processes - however
LANGrequires both a language part and encoding, so ifLANGisn’t already set, we don’t know what to set this to. In VS Code it seems thatIntl.DateTimeFormat().resolvedOptions().localereturns the correct thing for the main process, however it’s incorrect in the extension host.I’ve opened https://github.com/microsoft/vscode/issues/85675 to see if this can be fixed. Using
dart.envis still the current workaround, but I think if VS Code can expose the system language to us, we could set this explicitly to avoid the need for that.Weird - that’s not set in your other env, so I’m not sure what’s going on. There have been some issues in Flutter that are related to locale, like
I don’t really understand what’s happening, but I’ll close this as there’s a fix for now. If others reading are seeing this too, please comment here - if it’s affecting a lot of people then we might want to dig deeper.