Cocopods 常见报错

error1.

系统:10.13.6
命令:sudo gem install cocoapods

ERROR:  While executing gem ... (Gem::FilePermissionError)     You don't have write permissions for the /usr/bin directory.

执行此命令即可

sudo gem install cocoapods -n /usr/local/bin

error2.

系统:10.14.6
命令:sudo gem install cocoapods

$ sudo gem install cocoapods
Building native extensions. This could take a while...
ERROR:  Error installing sass:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.11.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -I /Library/Ruby/Site/2.3.0 -r ./siteconf20191022-2775-1q9uxye.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.11.1 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.11.1/gem_make.out

解决办法:执行下面命令按提示执行

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

error3.

[!] CDN: trunk Repo update failed - 24 error(s):

解决办法:Podfile文件中添加下面代码

source 'https://github.com/CocoaPods/Specs.git'

如果pod search有些库不正常,可以执行:

pod repo remove trunk
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

友情链接更多精彩内容