将 swiftLint 添加到项目后 运行 pod install 时出错
Error when run pod install after add swiftLint to project
长话短说
我正在尝试使用 cocoapods 将 SwiftLint 添加到我的项目中,但是在我添加 运行 脚本之后,我无法执行 pod install
和 pod update
没有错误。
每次我执行 pod install
我都会得到错误
/Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/sidekick.rb:67:in `url_for_request': uninitialized constant GhInspector::Sidekick::ERB (NameError)
from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/sidekick.rb:24:in `search'
from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/inspector.rb:65:in `search_query'
from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/inspector.rb:59:in `search_exception'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface/error_report.rb:119:in `search_for_exceptions'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:67:in `report_error'
from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:396:in `handle_exception'
from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:337:in `rescue in run'
from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:324:in `run'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:22:in `load'
from /usr/local/bin/pod:22:in `<main>'
现在完整描述
从头开始使用SwiftLint,我把它添加到我的podfile
platform :ios, '10.0'
use_frameworks!
target 'ProjectName' do
pod 'Realm'
pod 'RealmSwift'
pod 'Fabric'
pod 'Crashlytics'
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/AdMob'
pod 'SwiftLint'
end
然后我安装 pods 没有任何错误。
在此之后我添加 .swiftlint.yml
文件:
disabled_rules: # rule identifiers to exclude from running
- trailing_whitespace
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
在这一点上,我仍然能够像魅力一样执行 pod install
和 pod update
,但是 SwiftLint 配置仍然缺少最后一步才能工作。
添加运行脚本后
if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
SwiftLint 开始工作,但是,正如我在问题开头所说的,我无法 运行 pod install
和 pod update
版本数据
ruby版本:
ruby 2.5.1p57(2018-03-29 修订版 63029)[x86_64-darwin18]
可可pods版本:
1.5.3
SwiftLint 版本:
0.27.0
知道如何解决这个错误吗?
您的环境似乎还可以。
您是否创建了另一个 运行 脚本?
将 swiftlint 脚本放在 运行 已经存在的脚本上,或者为您创建的每个 "Run Script" 指定一个不同的名称。
"${PODS_ROOT}/SwiftLint/swiftlint"
已将您的 运行 脚本更新为此
长话短说
我正在尝试使用 cocoapods 将 SwiftLint 添加到我的项目中,但是在我添加 运行 脚本之后,我无法执行 pod install
和 pod update
没有错误。
每次我执行 pod install
我都会得到错误
/Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/sidekick.rb:67:in `url_for_request': uninitialized constant GhInspector::Sidekick::ERB (NameError)
from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/sidekick.rb:24:in `search'
from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/inspector.rb:65:in `search_query'
from /Library/Ruby/Gems/2.3.0/gems/gh_inspector-1.1.2/lib/gh_inspector/inspector.rb:59:in `search_exception'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/user_interface/error_report.rb:119:in `search_for_exceptions'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:67:in `report_error'
from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:396:in `handle_exception'
from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:337:in `rescue in run'
from /Library/Ruby/Gems/2.3.0/gems/claide-1.0.2/lib/claide/command.rb:324:in `run'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/lib/cocoapods/command.rb:52:in `run'
from /Library/Ruby/Gems/2.3.0/gems/cocoapods-1.5.3/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:22:in `load'
from /usr/local/bin/pod:22:in `<main>'
现在完整描述
从头开始使用SwiftLint,我把它添加到我的podfile
platform :ios, '10.0'
use_frameworks!
target 'ProjectName' do
pod 'Realm'
pod 'RealmSwift'
pod 'Fabric'
pod 'Crashlytics'
pod 'Firebase'
pod 'Firebase/Core'
pod 'Firebase/AdMob'
pod 'SwiftLint'
end
然后我安装 pods 没有任何错误。
在此之后我添加 .swiftlint.yml
文件:
disabled_rules: # rule identifiers to exclude from running
- trailing_whitespace
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Pods
在这一点上,我仍然能够像魅力一样执行 pod install
和 pod update
,但是 SwiftLint 配置仍然缺少最后一步才能工作。
添加运行脚本后
if which swiftlint >/dev/null; then
swiftlint
else
echo "warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint"
fi
SwiftLint 开始工作,但是,正如我在问题开头所说的,我无法 运行 pod install
和 pod update
版本数据
ruby版本: ruby 2.5.1p57(2018-03-29 修订版 63029)[x86_64-darwin18]
可可pods版本: 1.5.3
SwiftLint 版本: 0.27.0
知道如何解决这个错误吗?
您的环境似乎还可以。 您是否创建了另一个 运行 脚本? 将 swiftlint 脚本放在 运行 已经存在的脚本上,或者为您创建的每个 "Run Script" 指定一个不同的名称。
"${PODS_ROOT}/SwiftLint/swiftlint"
已将您的 运行 脚本更新为此