当我在cordova项目上执行sudo cordova requirements
时,会收到以下响应:
Requirements check results for ios:
Apple macOS: installed darwin
Xcode: installed [object Object]
ios-deploy: installed [object Object]
CocoaPods: not installed
/Users/username/.rvm/rubies/ruby-2.5.0/lib/ruby/gems/2.5.0/gems/claide-1.0.2/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)
但是我已经成功安装了cocoapods:
MacBook-Pro-di-Name:~ username$ sudo gem install cocoapods
Successfully installed cocoapods-1.5.3
Parsing documentation for cocoapods-1.5.3
Done installing documentation for cocoapods after 4 seconds
1 gem installed
MacBook-Pro-di-Name:project-cordova username$ pod --version
1.5.3
我在here或here之类的其他帖子中也找到了类似的问题。如果尝试第二种解决方案,我会得到
MacBook-Pro-di-Name:project-cordova username$ sudo chown -R $USER ~/Library/Caches/CocoaPods
chown: /Users/username/Library/Caches/CocoaPods: No such file or directory
MacBook-Pro-di-Name:project-cordova username$ sudo chown -R $USER ~/.cocoapods
chown: /Users/username/.cocoapods: No such file or directory
MacBook-Pro-di-Name:sbc-cordova username$ sudo chown -R $USER ./Pods
chown: ./Pods: No such file or directory
我还尝试在Mac上更新Ruby版本。什么都没有为我工作。我有Sierra(10.12.3)和最新的Cordova版本(8.0.0),有解决此问题的想法吗?预先感谢