我从昨天升级 flutter 后收到此错误。升级之前,iOS 和 android 上的一切正常。现在我的项目不是在 iOS 中构建的。下面是我的终端信息。
pod 设置 --verbose
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)
pod 安装 --verbose
WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8
[!] No `Podfile' found in the project directory.
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:151:in `verify_podfile_exists!'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command/install.rb:46:in `run'
/Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:334:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/lib/cocoapods/command.rb:52:in `run'
/Library/Ruby/Gems/2.3.0/gems/cocoapods-1.8.4/bin/pod:55:in `<top (required)>'
/usr/local/bin/pod:22:in `load'
/usr/local/bin/pod:22:in `<main>'
Run Code Online (Sandbox Code Playgroud)
语言环境
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=
Run Code Online (Sandbox Code Playgroud)
提前致谢
Job*_*b M 245
open ~/.zshrc(或者open ~/.profile如果您不使用 zsh)看来LANG="en_US.UTF-8"光有这个还不够,所以还得设置:
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)
保存文件
返回终端并键入source ~/.zshrc并键入locale
您现在可以安全地运行 pod update 或 pod install
小智 13
请按照以下步骤解决此问题
Cmd + Shift + dot。.zshrc#User configuration注释掉export LANG=en_US.UTF-8。pod installshr*_*ari 10
最后我通过以下步骤解决了这个问题
flutter build ios并解决了。
tyi*_*ine 10
要迭代 Shruti Tupkari 的答案~ 要添加export LANG=en_US.UTF-8到您的终端,需要将其添加到配置文件中,例如.zshrc、.bashrc或.bash_profile。
为此,只需使用vim
所以尝试一下
vim .zshrc
Run Code Online (Sandbox Code Playgroud)
这应该会打开您的.zshrc个人资料。输入“i”插入一些内容。
然后只需粘贴export LANG=en_US.UTF-8按 esc 即可退出,然后键入:wq保存并退出
尝试再次运行您的应用程序。如果出现错误,请在计算机中的其他配置文件上重复相同的步骤。
这里有一些关于如何使用 vim 的信息
https://www.howtoforge.com/vim-basics
flutter cleanvim .zshrc您的终端。这应该会打开您的.zshrc个人资料。键入I以插入内容。然后,只需粘贴导出LANG=en_US.UTF-8并点击ESC退出,然后键入:wq以保存并退出。# platform :ios, '9.0' to 平台 :ios, '10.0'flutter build iOS通过终端在主根项目中运行。flutter run您是否在 Flutter 中遇到问题。试试这个解决方案
flutter cleanflutter build ios解决Cocoapods UTF-8错误:(详细解释)
我们需要将终端的区域设置更改为 UTF-8。
步骤 1:打开终端,输入 locale,按 Enter 键,然后检查它显示的区域设置。
步骤2:如果是bash终端,将其更改为zsh终端,
步骤 3:然后打开 Finder,转到 mac HD、用户、包含您的用户名的文件夹,然后按 command+shift+。打开隐藏文件
步骤 4:创建或打开名为 .zshrc 的文件
第 5 步:将其粘贴到此处:
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)
第6步:通过command + s保存
步骤 7:然后再次打开终端并通过键入、区域设置并按 Enter 键进行检查(然后您可以保持它打开或关闭终端)
步骤 8:如果它显示其他区域设置而不是 UTF-8,则粘贴以下 3 行并按 Enter:
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)
第9步:然后打开Android Studio,进入终端并粘贴上面3行相同的内容,然后按回车键
第10步:然后在您的项目文件上,转到ios文件夹,右键单击它,然后在终端中打开,然后在终端中粘贴与上述3行相同的内容,然后按回车键
第 11 步:现在您可以通过键入 pod install 在此终端中安装 pod。
现在它可以工作了,如果您仍然遇到相同的错误,请转到工具 -> flutter -> flutter clean 并通过单击文件 -> 重新启动 ide 或类似的选项来重新启动 android studio。
然后在你的项目上,右键单击 ios 文件夹并打开终端,输入 locale,然后按 Enter,如果现在不是 UTF-8,那么从步骤 9 再次到步骤 11,现在就可以工作了。您现在可以在 iOS 设备上运行您的应用程序。
我的仓库 -> https://github.com/anantha-eswar/
如果添加export LANG=en_US.UTF-8没有帮助,请尝试export LC_ALL="en_US.UTF-8"
学分: https: //github.com/CocoaPods/CocoaPods/issues/6333#issuecomment-551052399
就我而言,需要添加以下内容而.bash_profile不是其他建议的文件。
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
Run Code Online (Sandbox Code Playgroud)