努力奔跑
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi
在 before_install
中,我最终得到了
/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in \`<main>': Homebrew must be run under Ruby 2.3! (RuntimeError)
The command "if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3; fi" failed and exited with 1 during .
Your build has been stopped.
/Users/travis/.travis/job_stages: line 166: shell_session_update: command not found
所以我假设这里的问题是 ruby
是 2.0 版,我用 ruby --version
确认了这一点。有趣的是,我的构建突然停止工作,没有对 .travis.yml 进行任何更改。
那么我该如何实际更改 Ruby 版本呢?
可能很重要,但在 git clone
运行之前我得到了这个:
$ rvm use
Warning! PATH is not properly set up, '/Users/travis/.rvm/gems/ruby-2.0.0-p648/bin' is not at first place,
usually this is caused by shell initialization files - check them for 'PATH=...' entries,
it might also help to re-add RVM to your dotfiles: 'rvm get stable --auto-dotfiles',
to fix temporarily in this shell session run: 'rvm use ruby-2.0.0-p648'.
最佳答案
您的选择似乎是使用
brew update
brew install whatever
或
HOMEBREW_NO_AUTO_UPDATE=1 brew install whatever
travis documentation中的建议如果似乎不需要 brew update
,那么当 brew 的 ruby 要求发生变化时,您将面临随机损坏的风险......
关于ruby - 如何在 Travis CI 的 macOS 中更改 Homebrew 的 Ruby 版本?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46670305/