[macOS]: failed to launch from VSCode: ArgumentError - invalid byte sequence in US-ASCII
See original GitHub issue_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.
Issue Analytics
- State:
- Created 4 years ago
- Comments:29 (17 by maintainers)
Top Results From Across the Web
"invalid byte sequence" running remote code via ssh from ...
Running File.open('/home/bob/input.txt').read.encoding gives US-ASCII when executed from Windows/Cygwin/ssh and UTF-8 from macOS/Terminal/ssh.
Read more >Fix for bundle install: ArgumentError: invalid byte sequence in ...
I stumbled across a weird issue with bundler on MacOS X: ... v2.1) ArgumentError: invalid byte sequence in US-ASCII An error occured whileΒ ......
Read more >error running pod install - You.com | The AI Search Engine ...
I am trying to run my application in ios simulator but i am getting below error. The application was running okay but then...
Read more >Trying to install Brew on MacOS 10.10.5. Getting "invalid byte ...
Coding example for the question Trying to install Brew on MacOS 10.10.5. Getting "invalid byte sequence in UTF-8 (ArgumentError)"-ruby.
Read more >colorls/CHANGELOG and colorls Releases | LibHunt
Can't re-install colorls after updating to macOS Big Sur #418 ... invalid byte sequence in US-ASCII (ArgumentError) #352; An error was reported after...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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:
LANG
etc.) because it affects how it reads filesLANG
env var is set by the terminal at startup - it is not set system-wide for programs not launched from the terminalLANG
set, that results in us spawningflutter run
without 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
LANG
requires both a language part and encoding, so ifLANG
isnβt already set, we donβt know what to set this to. In VS Code it seems thatIntl.DateTimeFormat().resolvedOptions().locale
returns 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.env
is 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.