AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / ubuntu / 问题

问题[ruby](ubuntu)

Martin Hope
MckPT
Asked: 2021-08-13 10:01:48 +0800 CST

Ubuntu Server 20.04 Redmine Ruby 版本错误

  • 0

完成从 18.04 升级到 20.04,我安装了 Redmine,完成升级后,Redmine 停止了。

当我尝试访问时,出现错误:

Could not find concurrent-ruby-1.1.9 in any of the sources (Bundler::GemNotFound)

错误的回溯:

/usr/lib/ruby/2.7.0/bundler/spec_set.rb:86:in `block in materialize'
/usr/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `map!'
/usr/lib/ruby/2.7.0/bundler/spec_set.rb:80:in `materialize'
/usr/lib/ruby/2.7.0/bundler/definition.rb:170:in `specs'
/usr/lib/ruby/2.7.0/bundler/definition.rb:237:in `specs_for'
/usr/lib/ruby/2.7.0/bundler/definition.rb:226:in `requested_specs'
/usr/lib/ruby/2.7.0/bundler/runtime.rb:101:in `block in definition_method'
/usr/lib/ruby/2.7.0/bundler/runtime.rb:20:in `setup'
/usr/lib/ruby/2.7.0/bundler.rb:149:in `setup'
/usr/lib/ruby/2.7.0/bundler/setup.rb:20:in `block in <top (required)>'
/usr/lib/ruby/2.7.0/bundler/ui/shell.rb:136:in `with_level'
/usr/lib/ruby/2.7.0/bundler/ui/shell.rb:88:in `silence'
/usr/lib/ruby/2.7.0/bundler/setup.rb:20:in `<top (required)>'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:365:in `activate_gem'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:221:in `block in run_load_path_setup_code'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:529:in `running_bundler'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:220:in `run_load_path_setup_code'
/usr/share/passenger/helper-scripts/rack-preloader.rb:91:in `preload_app'
/usr/share/passenger/helper-scripts/rack-preloader.rb:189:in `block in <module:App>'
/usr/lib/ruby/vendor_ruby/phusion_passenger/loader_shared_helpers.rb:382:in `run_block_and_record_step_progress'
/usr/share/passenger/helper-scripts/rack-preloader.rb:188:in `<module:App>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:30:in `<module:PhusionPassenger>'
/usr/share/passenger/helper-scripts/rack-preloader.rb:29:in `<main>'

当我运行捆绑安装时,看起来一切正常:

Your Gemfile lists the gem redmine_crm (>= 0) more than once.
You should probably keep only one of them.
Remove any duplicate entries and specify the gem only once.
While it's not a problem now, it could cause errors if you change the version of one of them later.
Using rake 13.0.6
Using concurrent-ruby 1.1.9
Using i18n 0.7.0
Using minitest 5.14.4
Using thread_safe 0.3.6
Using tzinfo 1.2.9
Using activesupport 5.2.3
Using builder 3.2.4
Using erubi 1.10.0
Using mini_portile2 2.4.0
Using nokogiri 1.10.10
Using rails-dom-testing 2.0.3
Using crass 1.0.6
Using loofah 2.12.0
Using rails-html-sanitizer 1.3.0
Using actionview 5.2.3
Using rack 2.2.3
Using rack-test 1.1.0
Using actionpack 5.2.3
Using nio4r 2.5.8
Using websocket-extensions 0.1.5
Using websocket-driver 0.7.5
Using actioncable 5.2.3
Using globalid 0.5.2
Using activejob 5.2.3
Using mini_mime 1.0.3
Using mail 2.7.1
Using actionmailer 5.2.3
Using method_source 1.0.0
Using thor 1.1.0
Using railties 5.2.3
Using actionpack-xml_parser 2.0.1
Using activemodel 5.2.3
Using arel 9.0.0
Using activerecord 5.2.3
Using mimemagic 0.3.10
Using marcel 0.3.3
Using activestorage 5.2.3
Using public_suffix 4.0.6
Using addressable 2.8.0
Using bundler 2.2.25
Using css_parser 1.10.0
Using csv 3.0.9
Using htmlentities 4.3.4
Using liquid 2.6.3
Using mysql2 0.5.3
Using net-ldap 0.16.3
Using ruby-openid 2.3.0
Using rack-openid 1.4.2
Using sprockets 4.0.2
Using sprockets-rails 3.2.2
Using rails 5.2.3
Using rbpdf-font 1.19.1
Using rbpdf 1.19.8
Using redcarpet 3.4.0
Using rubyzip 2.3.2
Using redmine_crm 0.0.55
Using request_store 1.0.5
Using rmagick 2.16.0
Using roadie 3.5.1
Using roadie-rails 1.3.0
Using rouge 3.3.0
Bundle complete! 29 Gemfile dependencies, 62 gems now installed.
Gems in the groups 'development', 'teste', 'test', 'postgresql' and 'sqlite' were not installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

如果我检查它丢失的宝石:

* concurrent-ruby (1.1.9)
        Summary: Modern concurrency tools for Ruby. Inspired by Erlang, Clojure, Scala, Haskell, F#, C#, Java, and classic concurrency patterns.
        Homepage: http://www.concurrent-ruby.com
        Source Code: https://github.com/ruby-concurrency/concurrent-ruby
        Changelog: https://github.com/ruby-concurrency/concurrent-ruby/blob/master/CHANGELOG.md
        Path: /usr/share/rvm/gems/ruby-2.5.0/gems/concurrent-ruby-1.1.9

所以看起来 Redmine 它正在寻找 ruby​​ 2.7.0 文件夹中的宝石,而我在 2.5.0 文件夹中有宝石。

如果这是问题所在,我该怎么办?强制redmine使用ruby 2.5,看起来他最好的方法?或者强制gems安装在2.7版本,如果是这样,怎么办?删除 2.5,如果我运行 bundle install 它可以完成工作吗?

当前的 GemFile.Lock:

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.2.3)
      actionpack (= 5.2.3)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailer (5.2.3)
      actionpack (= 5.2.3)
      actionview (= 5.2.3)
      activejob (= 5.2.3)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.2.3)
      actionview (= 5.2.3)
      activesupport (= 5.2.3)
      rack (~> 2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionpack-xml_parser (2.0.1)
      actionpack (>= 5.0)
      railties (>= 5.0)
    actionview (5.2.3)
      activesupport (= 5.2.3)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.2.3)
      activesupport (= 5.2.3)
      globalid (>= 0.3.6)
    activemodel (5.2.3)
      activesupport (= 5.2.3)
    activerecord (5.2.3)
      activemodel (= 5.2.3)
      activesupport (= 5.2.3)
      arel (>= 9.0)
    activestorage (5.2.3)
      actionpack (= 5.2.3)
      activerecord (= 5.2.3)
      marcel (~> 0.3.1)
    activesupport (5.2.3)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.8.0)
      public_suffix (>= 2.0.2, < 5.0)
    arel (9.0.0)
    builder (3.2.4)
    capybara (2.18.0)
      addressable
      mini_mime (>= 0.1.3)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (>= 2.0, < 4.0)
    childprocess (3.0.0)
    concurrent-ruby (1.1.9)
    crass (1.0.6)
    css_parser (1.10.0)
      addressable
    csv (3.0.9)
    docile (1.1.5)
    erubi (1.10.0)
    globalid (0.5.2)
      activesupport (>= 5.0)
    htmlentities (4.3.4)
    i18n (0.7.0)
    json (2.5.1)
    liquid (2.6.3)
    loofah (2.12.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (0.3.3)
      mimemagic (~> 0.3.2)
    method_source (1.0.0)
    mimemagic (0.3.10)
      nokogiri (~> 1)
      rake
    mini_mime (1.0.3)
    mini_portile2 (2.4.0)
    minitest (5.14.4)
    mocha (1.13.0)
    mysql2 (0.5.3)
    net-ldap (0.16.3)
    nio4r (2.5.8)
    nokogiri (1.10.10)
      mini_portile2 (~> 2.4.0)
    public_suffix (4.0.6)
    puma (3.12.6)
    rack (2.2.3)
    rack-openid (1.4.2)
      rack (>= 1.1.0)
      ruby-openid (>= 2.1.8)
    rack-test (1.1.0)
      rack (>= 1.0, < 3)
    rails (5.2.3)
      actioncable (= 5.2.3)
      actionmailer (= 5.2.3)
      actionpack (= 5.2.3)
      actionview (= 5.2.3)
      activejob (= 5.2.3)
      activemodel (= 5.2.3)
      activerecord (= 5.2.3)
      activestorage (= 5.2.3)
      activesupport (= 5.2.3)
      bundler (>= 1.3.0)
      railties (= 5.2.3)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.3.0)
      loofah (~> 2.3)
    railties (5.2.3)
      actionpack (= 5.2.3)
      activesupport (= 5.2.3)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.19.0, < 2.0)
    rake (13.0.6)
    rbpdf (1.19.8)
      htmlentities
      rbpdf-font (~> 1.19.0)
    rbpdf-font (1.19.1)
    redcarpet (3.4.0)
    redmine_crm (0.0.55)
      liquid (< 2.6.4)
      rails
      rubyzip
    request_store (1.0.5)
    rmagick (2.16.0)
    roadie (3.5.1)
      css_parser (~> 1.4)
      nokogiri (~> 1.8)
    roadie-rails (1.3.0)
      railties (>= 3.0, < 5.3)
      roadie (~> 3.1)
    rouge (3.3.0)
    ruby-openid (2.3.0)
    rubyzip (2.3.2)
    selenium-webdriver (3.142.7)
      childprocess (>= 0.5, < 4.0)
      rubyzip (>= 1.2.2)
    simplecov (0.14.1)
      docile (~> 1.1.0)
      json (>= 1.8, < 3)
      simplecov-html (~> 0.10.0)
    simplecov-html (0.10.2)
    sprockets (4.0.2)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.2)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (1.1.0)
    thread_safe (0.3.6)
    tzinfo (1.2.9)
      thread_safe (~> 0.1)
    websocket-driver (0.7.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    yard (0.9.26)

PLATFORMS
  x86_64-linux

DEPENDENCIES
  actionpack-xml_parser
  bundler (>= 1.5.0)
  capybara (~> 2.13)
  csv (~> 3.0.1)
  i18n (~> 0.7.0)
  mail (~> 2.7.1)
  mimemagic
  mini_mime (~> 1.0.1)
  mocha
  mysql2 (~> 0.5.0)
  net-ldap (~> 0.16.0)
  nokogiri (~> 1.10.0)
  puma (~> 3.7)
  rack-openid
  rails (= 5.2.3)
  rails-dom-testing
  rbpdf (~> 1.19.6)
  redcarpet (~> 3.4.0)
  redmine_crm
  request_store (= 1.0.5)
  rmagick (~> 2.16.0)
  roadie-rails (~> 1.3.0)
  rouge (~> 3.3.0)
  ruby-openid (~> 2.3.0)
  selenium-webdriver
  simplecov (~> 0.14.1)
  tzinfo-data
  yard

BUNDLED WITH
   2.2.25

如果我查询 ruby​​ 版本:

ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]

但我可以看到我也安装了 2.7。

RVM 信息:

ruby-2.5.0:

  system:
    uname:        "Linux AtomServer 5.4.0-80-generic #90-Ubuntu SMP Fri Jul 9 22:49:44 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux"
    name:         "Ubuntu"
    version:      "20.04"
    architecture: "x86_64"
    bash:         "/bin/bash => GNU bash, version 5.0.17(1)-release (x86_64-pc-linux-gnu)"
    zsh:          " => not installed"
    remote_path:  "ubuntu/20.04/x86_64"

  rvm:
    version:      "1.29.11 (latest)"
    updated:      "6 months 20 days 7 hours 36 minutes 33 seconds ago"
    path:         "/usr/share/rvm"
    autolibs:     "[4] Allow RVM to use package manager if found, install missing dependencies, install package manager (only OS X)."

  ruby:
    interpreter:  "ruby"
    version:      "2.5.0p0"
    date:         "2017-12-25"
    platform:     "x86_64-linux"
    patchlevel:   "2017-12-25 revision 61468"
    full_version: "ruby 2.5.0p0 (2017-12-25 revision 61468) [x86_64-linux]"

  homes:
    gem:          "/usr/share/rvm/gems/ruby-2.5.0"
    ruby:         "/usr/share/rvm/rubies/ruby-2.5.0"

  binaries:
    ruby:         "/usr/share/rvm/rubies/ruby-2.5.0/bin/ruby"
    irb:          "/usr/share/rvm/rubies/ruby-2.5.0/bin/irb"
    gem:          "/usr/share/rvm/rubies/ruby-2.5.0/bin/gem"
    rake:         "/usr/share/rvm/gems/ruby-2.5.0/bin/rake"

  environment:
    PATH:         "/usr/share/rvm/gems/ruby-2.5.0/bin:/usr/share/rvm/gems/ruby-2.5.0@global/bin:/usr/share/rvm/rubies/ruby-2.5.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/jnap/.dotnet/tools:/usr/share/rvm/bin"
    GEM_HOME:     "/usr/share/rvm/gems/ruby-2.5.0"
    GEM_PATH:     "/usr/share/rvm/gems/ruby-2.5.0:/usr/share/rvm/gems/ruby-2.5.0@global"
    MY_RUBY_HOME: "/usr/share/rvm/rubies/ruby-2.5.0"
    IRBRC:        "/usr/share/rvm/rubies/ruby-2.5.0/.irbrc"
    RUBYOPT:      ""
    gemset:       ""

谢谢

ruby
  • 1 个回答
  • 1131 Views
Martin Hope
smehsan
Asked: 2020-09-30 01:05:01 +0800 CST

Gem::LoadError: 为数据库适配器指定“mysql”,

  • 0

我正在尝试为我的旧 Rails 项目运行 rake db:setup,它会引发以下错误。

`rake aborted!
Gem::LoadError: Specified 'mysql' for database adapter, but the gem is not loaded. Add `gem 'mysql'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord).


Caused by:
Gem::LoadError: mysql is not part of the bundle. Add it to your Gemfile.

Tasks: TOP => db:setup => db:schema:load_if_ruby => db:create
(See full trace by running task with --trace)`

这是我的红宝石版本ruby 2.3.8p459 (2018-10-18 revision 65136) [x86_64-linux]

我的导轨版本Rails 4.2.7.1

和mysql版本mysql Ver 14.14 Distrib 5.5.56, for linux-glibc2.5 (x86_64) using readline 5.1

谢谢

mysql ruby ruby-on-rails
  • 1 个回答
  • 925 Views
Martin Hope
Leder
Asked: 2020-06-25 06:44:31 +0800 CST

我在 Ubuntu 20.04 上安装了 chruby/ruby-install:无法从 bash-script 中执行 ruby

  • 0

我从这里有一个红宝石设置:

安装_ruby

现在,当我在 bash 脚本中运行 gem 时,出现以下错误:

/usr/bin/env: »ruby“: Datei oder Verzeichnis nicht gefunden

使用 PATH 变量或 ruby​​ 的 rvm 安装时出现相同错误的 Web 上的各种提示,没有帮助!

你有线索吗?

顺便说一句:在 CLI 上运行的 gem 工作得很好!

scripts command-line bash ruby
  • 1 个回答
  • 134 Views
Martin Hope
marinnen128
Asked: 2020-01-28 16:32:47 +0800 CST

在 Ubuntu 16.04 下从 shell 脚本访问已安装的 ruby​​ gem 包的问题

  • 3

我snap以前安装的是最新版的rubyUbuntu 16.04下

$ sudo snap install ruby --classic
$ which ruby
/snap/bin/ruby
$ ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux]

然后我安装了一个 ruby​​ gem pdfbeads(一个 PDF 创建实用程序)

sudo gem install pdfbeads

此命令将该实用程序安装在我的主目录中,为 ~/.gem/gems/pdfbeads-1.1.1/bin/pdfbeads. 但是,当我尝试在将 DJVU 文件转换为 PDF 格式的 shell 脚本中使用此程序时,我收到以下错误消息

djvu2pdf.sh: line 43: pdfbeads: command not found

虽然ruby链接在/snap/bin/我$PATH的默认情况下,~/.gem/但不是。这是gem environment安装后的pdfbeads:

$ gem environment
RubyGems Environment:
  - RUBYGEMS VERSION: 3.1.2
  - RUBY VERSION: 2.7.0 (2019-12-25 patchlevel 0) [x86_64-linux]
  - INSTALLATION DIRECTORY: ~/.gem
  - USER INSTALLATION DIRECTORY: ~/.gem/ruby/2.7.0
  - RUBY EXECUTABLE: /snap/bin/ruby
  - GIT EXECUTABLE: /usr/bin/git
  - EXECUTABLE DIRECTORY: ~/.gem/bin
  - SPEC CACHE DIRECTORY: ~/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: //etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-linux
  - GEM PATHS:
     - ~/.gem
     - /snap/ruby/172/lib/ruby/gems/2.7.0
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /usr/local/sbin
     - /usr/local/bin
     - /usr/sbin
     - /usr/bin
     - /sbin
     - /bin
     - /usr/games
     - /usr/local/games
     - /snap/bin

我原以为 gem 包安装应该已经解决了路径问题,但显然情况并非如此 -pdfbeads不在执行目录路径中。

显然,我可以将这个特定目录添加~/.gem/gems/pdfbeads-1.1.1/bin/到我的目录中$PATH来解决这个特定问题。但是,由于这是我第一次使用ruby,所以我正在寻找一种更通用的解决方案,每次安装另一个 ruby​​ gem 时都不需要这样做。

我有一个问题要问所有ruby专家 - 是否有一些标准的、更优雅的方法来解决这个问题,也可以涵盖任何未来的 gem 安装?

ruby paths gem 16.04
  • 1 个回答
  • 1402 Views
Martin Hope
user3447014
Asked: 2019-11-24 07:48:26 +0800 CST

运行桌面快捷方式只是在文本编辑器中打开它

  • 5

我查看了与该主题有关的其他一些 StackExchange 问题,但无论出于何种原因,我仍然无法解决。

这是test.desktop我桌面上的简单文件:

[Desktop Entry]
Version=1.0
Name=Test        
Comment=Test the terminal running a command inside it
Exec=gnome-terminal -e "~/test.rb"
Icon=utilities-terminal
Terminal=false
Type=Application
Categories=Application;

我只是想创建一个在双击时运行 Ruby 脚本的快捷方式。我试图让最终用户非常容易打开它,但是当我双击文件时,它只会在文本编辑器中不断打开。

我还验证了它也具有写入权限,但仍然没有。如果我替换~/test.rb为ifconfig,它仍然不起作用。

我在这里做错了什么?

gnome command-line unity ruby .desktop
  • 1 个回答
  • 2904 Views
Martin Hope
Loki
Asked: 2019-07-25 05:03:15 +0800 CST

为什么 sudo crontab 不起作用但 crontab 起作用?

  • 1

我想执行一个包含 sudo 命令的 ruby​​ 脚本。如果我在“ crontab -e ”中输入此命令,它可以正常工作:

* * * * * /usr/bin/ruby ~/myfolder/test.rb >> ~/myfolder/mylog.log 2>&1

由于我的脚本包含 sudo 命令,我使用“sudo crontab -e”并写道:

* * * * * /usr/bin/ruby home/USERNAME/myfolder/test.rb >> home/USERNAME/myfolder/mylog.log 2>&1

但是,它不起作用。在第二种情况下不会创建日志文件。我以前也有不同的地址。

scripts command-line bash cron ruby
  • 1 个回答
  • 253 Views
Martin Hope
current_user
Asked: 2019-04-04 21:36:23 +0800 CST

使用 nginx 重定向到“www”前缀域

  • 1

我在 godady 中引入了一个域,并在 Linux/Unix(Ubuntu) 服务器上安装了Passenger + Nginx,并部署了一个 Ruby 应用程序。现在,当我尝试从浏览器请求时,我的域看起来像 http://example.com 。但我希望我的域在每次从浏览器(如http://www.example.com .)请求时默认重定向到www 。

例子.conf

    server {
    listen 80;
    server_name www.example.com example.com;
    # return 301 $scheme://www.example.com$request_uri;
    # Tell Nginx and Passenger where your app's 'public' directory is
    root /var/www/example/public;

    # Turn on Passenger
    passenger_enabled on;
    passenger_spawn_method direct;
    passenger_min_instances 1;
    #passenger_pool_idle_time 0;
    rails_env development;
    passenger_ruby /usr/local/rvm/gems/ruby-2.3.3/wrappers/ruby;
    passenger_sticky_sessions on;


}

取消注释该行

返回 301 $scheme://www.example.com$request_uri;

正在抛出错误

www.example.com redirected you too many times.
Try clearing your cookies.
ERR_TOO_MANY_REDIRECTS

我被迫在浏览器中手动输入www.example.com 。相反,我如何默认重定向到www ?

非常感谢任何帮助。提前致谢!

server dns ruby nginx
  • 2 个回答
  • 481 Views
Martin Hope
Hasan
Asked: 2018-12-25 03:38:41 +0800 CST

nokogiri 安装错误 - mkmf.rb 找不到头文件

  • 1

当我尝试安装 nokigiri 时,我得到以下信息,

Building native extensions.  This could take a while...
ERROR:  Error installing nokogiri:
ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.4.0/gems/nokogiri-1.9.1/ext/nokogiri
/usr/bin/ruby2.4 -r ./siteconf20181224-15718-15hfw3z.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.4.0/gems/nokogiri-1.9.1 for inspection.
Results logged to /var/lib/gems/2.4.0/extensions/x86_64-linux/2.4.0/nokogiri-1.9.1/gem_make.out

我安装了这些版本的 ruby​​ - 1.9.1、2.0.0 和 2.4.0。

ruby
  • 1 个回答
  • 1613 Views
Martin Hope
Kiran Shahi
Asked: 2018-07-13 21:50:40 +0800 CST

在适用于 Linux 的 Windows 子系统上安装 ruby​​ 时出错

  • 2

我正在尝试按照Jekyll on Windows 教程安装 Jekyll 。从BrightBox存储库安装 ruby​​ 有一个陡峭的过程。我触发了以下命令:

sudo apt-add-repository ppa:brightbox/ruby-ng
sudo apt-get update
sudo apt-get install ruby2.4 ruby2.4-dev build-essential dh-autoreconf

最后一个命令产生以下错误:

sudo apt-get install ruby2.4 ruby2.4-dev build-essential dh-autoreconf
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ruby2.4
E: Couldn't find any package by glob 'ruby2.4'
E: Couldn't find any package by regex 'ruby2.4'
E: Unable to locate package ruby2.4-dev
E: Couldn't find any package by glob 'ruby2.4-dev'
E: Couldn't find any package by regex 'ruby2.4-dev' 

我该如何解决这个问题?

software-installation apt ruby windows-subsystem-for-linux
  • 1 个回答
  • 2712 Views
Martin Hope
Shane.D
Asked: 2018-06-11 00:56:12 +0800 CST

Ruby gem 安装失败

  • 3

我试图安装gosuRyby gem

$ sudo gem install gosu

Building native extensions. This could take a while...

ERROR:  Error installing gosu:

    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.5.0/gems/gosu-0.13.3/ext/gosu
/usr/bin/ruby2.5 -r ./siteconf20180610-10446-laumk5.rb extconf.rb
The Gosu gem requires some libraries to be installed system-wide.
See the following site for a list:

https://github.com/gosu/gosu/wiki/Getting-Started-on-Linux

checking for TTF_RenderUTF8_Blended() in -lSDL2_ttf... yes

checking for SDL_ttf.h... yes

checking for -lopenal... no

creating Makefile

current directory: /var/lib/gems/2.5.0/gems/gosu-0.13.3/ext/gosu

make "DESTDIR=" clean

current directory: /var/lib/gems/2.5.0/gems/gosu-0.13.3/ext/gosu

make "DESTDIR="

compiling ../../src/Audio.cpp

In file included from ../../src/Audio.cpp:1:0:

../../src/AudioImpl.hpp:9:10: fatal error: AL/al.h: No such file or directory

 #include <AL/al.h>

          ^~~~~~~~~

compilation terminated.

Makefile:234: recipe for target 'Audio.o' failed

make: *** [Audio.o] Error 1

make failed, exit code 2

Gem files will remain installed in /var/lib/gems/2.5.0/gems/gosu-0.13.3 for inspection.

Results logged to /var/lib/gems/2.5.0/extensions/x86_64-linux/2.5.0/gosu-

0.13.3/gem_make.out

shane@shane-HP-x2-Detachable-10-p0XX:~$ sudo apt-get install -lopenal

E: Command line option 'l' [from -lopenal] is not understood in combination 
with the other options.

我注意到问题出在 -lopenal 上,但是如何安装或获取它才能正确下载

编辑: -lopenal 现在有一个是的感谢 N0rbert。但是现在我看到它在屏幕下方显示“致命错误”,那么我该如何解决这个问题?

ruby
  • 2 个回答
  • 3242 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    如何运行 .sh 脚本?

    • 16 个回答
  • Marko Smith

    如何安装 .tar.gz(或 .tar.bz2)文件?

    • 14 个回答
  • Marko Smith

    如何列出所有已安装的软件包

    • 24 个回答
  • Marko Smith

    无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗?

    • 25 个回答
  • Martin Hope
    Flimm 如何在没有 sudo 的情况下使用 docker? 2014-06-07 00:17:43 +0800 CST
  • Martin Hope
    Ivan 如何列出所有已安装的软件包 2010-12-17 18:08:49 +0800 CST
  • Martin Hope
    La Ode Adam Saputra 无法锁定管理目录 (/var/lib/dpkg/) 是另一个进程在使用它吗? 2010-11-30 18:12:48 +0800 CST
  • Martin Hope
    David Barry 如何从命令行确定目录(文件夹)的总大小? 2010-08-06 10:20:23 +0800 CST
  • Martin Hope
    jfoucher “以下软件包已被保留:”为什么以及如何解决? 2010-08-01 13:59:22 +0800 CST
  • Martin Hope
    David Ashford 如何删除 PPA? 2010-07-30 01:09:42 +0800 CST

热门标签

10.10 10.04 gnome networking server command-line package-management software-recommendation sound xorg

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve