web-deployment - 如何纠正 netlify 部署的错误
问题描述
我在部署到 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.
但我不知道如何解决它们。你可以帮助我 ?
解决方案
在 Netlify 上更改 ruby 版本的方法:
将.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: ```
推荐阅读
- php - 如何在 PHP 中访问 JSON 文件中的特定对象?
- docker - 如何从 pod 中查找 pod 终止原因?
- php - 从字符串中获取日期
- javascript - 成功登录后反应重定向,但页面在刷新之前不会更新
- php - 如何在多个条件下通过 5 次迭代增加变量值
- c - 这在 C ((TYPE){}) 中意味着什么。该片段取自: __typeof__ ( ((TYPE){}).MEMBER )
- java - 从 ArrayList 生成定义的集合
- jquery - Bootstrap 4 模态视频上的 jQuery - 使代码干燥
- spring-boot - 如何部署corda节点和对应的spring boot API
- rust - 为什么类型推断在添加期间不起作用,而在分配期间起作用