小编Gre*_*reg的帖子

gem install nokogiri -v'1.6.8.1'失败了

构建一个新的Rails应用程序并解决nokogiri的问题.据说尝试gem install nokogiri -v '1.6.8.1'哪个失败,输出如下.我尝试删除Gemfile.lock并使用另一个没有问题的应用程序的Gemfile bundle install仍然失败.最初的失败是bundle install继续在其他应用程序中工作.

从控制台:

gem install nokogiri -v '1.6.8.1'
Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
    ERROR: Failed to build gem native extension.

    current directory: ~/.gem/ruby/2.3.1/gems/nokogiri-1.6.8.1/ext/nokogiri
~/.rubies/ruby-2.3.1/bin/ruby -r ./siteconf20161008-60071-tmqi2l.rb extconf.rb
Ignoring byebug-6.0.2 because its extensions are not built.  Try: gem pristine byebug --version 6.0.2
Ignoring byebug-3.4.0 because its extensions are not built.  Try: gem pristine byebug --version 3.4.0
checking if the C compiler accepts ... …
Run Code Online (Sandbox Code Playgroud)

ruby rubygems ruby-on-rails nokogiri bundler

22
推荐指数
2
解决办法
9158
查看次数

使用rbenv安装Ruby的gem

如何使用rbenv控制安装哪个Ruby gem?或者所有红宝石都有可以进入的中心位置?我只是运行Ruby脚本而不是Rails.rbenv-gemset似乎是为了这个?

ruby rubygems rbenv

15
推荐指数
1
解决办法
1万
查看次数

在 Webpacker 中使用 Rails 6 中的 Bootstrap 图标

我想在测试版“Bootstrap 的官方开源 SVG 图标库”中使用 Bootstrap 图标。https://icons.getbootstrap.com/。这适用于 Rails 6 中的 Bootstrap 4。

我尝试了各种导入并包含在 application.js 和 application.scss 中,但没有成功

我该如何实现?

css ruby-on-rails twitter-bootstrap bootstrap-4 webpacker

13
推荐指数
3
解决办法
4025
查看次数

GeoJSON中LineString和Multipoint之间的区别是什么

GeoJSON中LineString和MultiPoint有什么区别?

对我来说,给出的例子是相同的.http://geojson.org/geojson-spec.html#id3.

我正在计划GeoJSON中的一些东西,如果基本的东西让我感到困惑,那我就麻烦了.

gis geojson

9
推荐指数
2
解决办法
4548
查看次数

Rails 包无法安装 gem ffi

注意:我放弃了这个并决定尝试 Rails 6 和 Webpacker,而不是打这场仗。继续其他战斗。

An error occurred while installing ffi (1.13.1), and Bundler cannot continue.我知道这是一个反复出现的问题,我之前用 nokogiri 遇到过它,但这次似乎找不到解决方案。我已经阅读并尝试了许多基于搜索 SO 以及显示为类似问题的建议。

部分 Gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
   repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
      "https://github.com/#{repo_name}.git"
end

ruby '2.7.0'
gem 'rails', '~> 5.2.0' 
gem 'pg' , '~> 0.18' 
gem 'puma'
gem 'bootstrap', '~> 4'
Run Code Online (Sandbox Code Playgroud)

终端(略有编辑),从响应错误开始:

? gem install ffi -v '1.13.1' --source 'https://rubygems.org/'
Building native extensions. This could take a while...
Successfully installed ffi-1.13.1
1 gem installed

? bundle update
Fetching gem …
Run Code Online (Sandbox Code Playgroud)

rubygems ruby-on-rails heroku bundler

4
推荐指数
2
解决办法
7273
查看次数

与模块 babel-plugin-syntax-dynamic-import 相关的 Webpacker 错误

尝试加载页面时出错。Rails 6,Ruby 2.7.1。来自终端的用于 javascript 和 SCSS 的 Webpacker(类似于 Chrome 控制台错误)

Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Cannot find module 'babel-plugin-syntax-dynamic-import' from '<path_to_my_app>'
- Did you mean "@babel/syntax-dynamic-import"?
 at Function.resolveSync [as sync] (<path_to_my_app>/node_modules/resolve/lib/sync.js:89:15)
 at resolveStandardizedName (<path_to_my_app>/node_modules/@babel/core/lib/config/files/plugins.js:101:31)
 at resolvePlugin (<path_to_my_app>/node_modules/@babel/core/lib/config/files/plugins.js:54:10)
 at loadPlugin (<path_to_my_app>/node_modules/@babel/core/lib/config/files/plugins.js:62:20)
 at createDescriptor (<path_to_my_app>/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
 at <path_to_my_app>/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
 at Array.map (<anonymous>)
 at createDescriptors (<path_to_my_app>/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
 at createPluginDescriptors (<path_to_my_app>/node_modules/@babel/core/lib/config/config-descriptors.js:105:10)
 at plugins (<path_to_my_app>/node_modules/@babel/core/lib/config/config-descriptors.js:40:19)
 at mergeChainOpts (<path_to_my_app>/node_modules/@babel/core/lib/config/config-chain.js:319:26)
 at <path_to_my_app>/node_modules/@babel/core/lib/config/config-chain.js:283:7
 at Generator.next (<anonymous>)
 at buildRootChain (<path_to_my_app>/node_modules/@babel/core/lib/config/config-chain.js:120:29)
 at buildRootChain.next (<anonymous>)
 at loadPrivatePartialConfig (<path_to_my_app>/node_modules/@babel/core/lib/config/partial.js:95:62)
 at loadPrivatePartialConfig.next (<anonymous>)
 at Function.<anonymous> …
Run Code Online (Sandbox Code Playgroud)

javascript rubygems ruby-on-rails babeljs webpacker

4
推荐指数
1
解决办法
3866
查看次数

如何将 bootstrap-icons 与 Rails 7 和 importmaps 结合使用

新领域:Rails 7.0.1、Ruby 3.1.0

rails new rails7app

bin/importmap pin bootstrap将引导程序添加到应用程序。

Bootstrap是js和css的结合体。bootstrap-icons看起来基本上都是css。使用yarn/npm方法yarn install bootstrap-icons可以工作,但是使用Rails 7并且没有npm则bin/importmap pin bootstrap-icons不起作用。有点预期,因为这是 css。

如何添加bootstrap-icons到基本 Rails 7 应用程序?

ruby-on-rails twitter-bootstrap import-maps ruby-on-rails-7

3
推荐指数
1
解决办法
4146
查看次数

如何在没有 trix 格式信息的情况下截断 ActionText 输出

我有一个 Rails 操作文本字段:content,如果我接受整个字段,它会呈现良好,但它很长,我只想显示其中的一部分。

<%= year.content %>工作正常,除了太长。

<%= year.content.truncate(70) %>结果是undefined method 'truncate' for #<ActionText::RichText:0x00007ffb811a6060>

<%= year.content.to_s.truncate(70) %>显示<div class="trix-content"> <div> <strong>Jack Marietich, restaura...我可以使用的内容,但是有没有一种方法我不必删除开头?

string ruby-on-rails actiontext

2
推荐指数
1
解决办法
2244
查看次数

Rails 形式的日期

我的 Rails 视图中有一个表单字段:

<%= f.date_select :Date_of_Birth %>

这显示了一个只有过去 10 年的下拉菜单,我需要回到 1800 年。如果我能直接输入年份而不是有 200 个项目的下拉列表,那就更好了。我还需要不填日期的选项,也就是空白。

我在 stackoverflow 中找到了一些提示,但它们并没有使用为我生成的这种格式。怀疑是因为我使用的是 Rails 4。

forms ruby-on-rails datepicker ruby-on-rails-4

1
推荐指数
1
解决办法
1406
查看次数