You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter项目执行pod install遇Unicode归一化编码错误求助

解决Flutter项目执行pod install时的ASCII-8BIT编码Unicode归一化错误

执行pod install时出现如下错误:

WARNING: CocoaPods requires your terminal to be using UTF-8 encoding.
Consider adding the following to ~/.profile:
export LANG=en_US.UTF-8

/Users/chandan/.rvm/rubies/ruby-3.1.0/lib/ruby/3.1.0/unicode_normalize/normalize.rb:141:in normalize': Unicode Normalization not appropriate for ASCII-8BIT (Encoding::CompatibilityError) from /Users/chandan/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/config.rb:167:in unicode_normalize'
from /Users/chandan/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/config.rb:167:in installation_root' from /Users/chandan/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.15.2/lib/cocoapods/config.rb:227:in podfile_path'

解决方案

1. 临时修复(当前终端会话有效)

在终端直接执行以下命令,随后重新运行pod install:

export LANG=en_US.UTF-8

2. 永久修复(所有终端会话生效)

根据你使用的Shell类型编辑对应配置文件:

  • Bash:编辑~/.bash_profile或~/.profile
  • Zsh:编辑~/.zshrc

在文件末尾添加以下内容:

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

保存后执行命令使配置生效:

  • Bash:source ~/.bash_profile 或 source ~/.profile
  • Zsh:source ~/.zshrc

3. RVM环境额外处理(若上述方法无效)

检查当前Ruby环境的编码设置:

rvm ruby-3.1.0 do ruby -e 'puts Encoding.default_external'

若输出不是UTF-8,编辑RVM环境配置文件~/.rvm/environments/ruby-3.1.0,添加:

export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8

执行以下命令重新加载RVM:

rvm reload

内容的提问来源于stack exchange,提问作者Chandan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 23:21:02