我在部署netlify时遇到了一些问题。我想用模板cayman
创建一个博客1)在本地主机中,站点可以正常运行
2)我将网站文件推送到github
3)我正在将netlify连接到github存储库
4)但是部署失败
日志:
8:46:46 AM: Fetching cached dependencies
8:46:46 AM: Failed to fetch cache, continuing with build
8:46:46 AM: Starting to prepare the repo for build
8:46:47 AM: No cached dependencies found. Cloning fresh repo
8:46:47 AM: git clone https://github.com/adrien1212/blog
8:46:47 AM: Preparing Git Reference refs/heads/master
8:46:48 AM: Starting build script
8:46:48 AM: Installing dependencies
8:46:49 AM: Downloading and installing node v8.15.0...
8:46:49 AM: Downloading https://nodejs.org/dist/v8.15.0/node-v8.15.0-linux-x64.tar.xz...
8:46:49 AM: 0.9%
8:46:49 AM:
#################
8:46:49 AM: 24.3%
8:46:49 AM:
##########################################
8:46:49 AM: ######################### 94.2%
######################################################################## 100.0%
8:46:49 AM: Computing checksum with sha256sum
8:46:49 AM: Checksums matched!
8:46:51 AM: Now using node v8.15.0 (npm v6.4.1)
8:46:52 AM: Attempting ruby version 2.3.6, read from environment
8:46:53 AM: Using ruby version 2.3.6
8:46:53 AM: Using PHP version 5.6
8:46:53 AM: Started restoring cached ruby gems
8:46:53 AM: Finished restoring cached ruby gems
8:46:53 AM: Installing gem bundle
8:46:53 AM: You must use Bundler 2 or greater with this lockfile.
8:46:53 AM: Error during gem install
8:46:53 AM: Error running command: Build script returned non-zero exit code: 1
8:46:53 AM: Failing build: Failed to build site
8:46:53 AM: failed during stage 'building site': Build script returned non-zero exit code: 1
8:46:53 AM: Finished processing build request in 7.611237844s
我认为问题将出在这里。
8:46:53 AM: Using ruby version 2.3.6
8:46:53 AM: Using PHP version 5.6
8:46:53 AM: You must use Bundler 2 or greater with this lockfile.
但是我不知道如何解决它们。你可以帮我吗?
答案 0 :(得分:0)
在Netlify上更改红宝石版本的方法:
在存储库的根目录中添加一个.ruby-version
文件
.ruby-version
(无最终换行符)
2.4.3
您可以改为使用RUBY_VERSION环境变量,该变量在Netlify的UI中的“构建和部署”设置或netlify.toml
中设置(根据Netlify支持)
注意: :可以从受rvm's
支持的版本中进行选择。
在Netlify上更改构建命令以输出捆绑软件信息:
使用bundle env && <your build command here>
作为构建命令
12:51:50 PM: Executing user command: bundle env && yarn build
12:51:50 PM: ## Environment
12:51:50 PM: ```
12:51:50 PM: Bundler 1.17.1
12:51:50 PM: Platforms ruby, x86_64-linux
12:51:50 PM: Ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-linux]
12:51:50 PM: Full Path /opt/buildhome/.rvm/rubies/ruby-2.4.3/bin/ruby
12:51:50 PM: Config Dir /etc
12:51:50 PM: RubyGems 2.6.14
12:51:50 PM: Gem Home /opt/buildhome/.rvm/gems/ruby-2.4.3
12:51:50 PM: Gem Path /opt/buildhome/.rvm/gems/ruby-2.4.3:/opt/buildhome/.rvm/gems/ruby-2.4.3@global
12:51:50 PM: User Path /opt/buildhome/.gem/ruby/2.4.0
12:51:50 PM: Bin Dir /opt/buildhome/.rvm/gems/ruby-2.4.3/bin
12:51:50 PM: Tools
12:51:50 PM: Git 2.19.1
12:51:50 PM: RVM 1.29.4 (latest)
12:51:50 PM: rbenv not installed
12:51:50 PM: chruby not installed
12:51:50 PM: rubygems-bundler (1.4.5)
12:51:50 PM: ```