Я не могу установить Rails.
Справочная информация: Моя (совершенно новая) система = Ubuntu 18.04, Ruby 2.6.0, последняя версия rvm и bundler установлены и обновлены. Первое, что я сделал после установки Ruby, это сделал sudo apt install ruby-railties
и sudo apt install rails
... Я не знаю, почему я не использовал gem install
. После этого я никогда успешно не выполнял rails new
, но я однажды выполнил его частично, но это не удалось, и именно тогда я начал спускаться по кроличьей норе.
Когда я набираю rails -v
, я получаю это:
Traceback (most recent call last):
4: from /home/globewalldesk/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:24:in `<main>'
3: from /home/globewalldesk/.rvm/gems/ruby-2.6.0/bin/ruby_executable_hooks:24:in `eval'
2: from /home/globewalldesk/.rvm/gems/ruby-2.6.0/bin/rails:23:in `<main>'
1: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:482:in `block in replace_bin_path'
/usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:462:in `block in replace_bin_path': can't find executable rails for gem railties. railties is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
Когда я пытаюсь выполнить gem install rails
, я получаю это:
Successfully installed concurrent-ruby-1.1.4
HEADS UP! i18n 1.1 changed fallbacks to exclude default locale.
But that may break your application.
Please check your Rails app for 'config.i18n.fallbacks = true'.
If you're using I18n (>= 1.1.0) and Rails (< 5.2.2), this should be
'config.i18n.fallbacks = [I18n.default_locale]'.
If not, fallbacks will be broken in your app by I18n 1.1.x.
For more info see:
https://github.com/svenfuchs/i18n/releases/tag/v1.1.0
Successfully installed i18n-1.5.2
Successfully installed thread_safe-0.3.6
Successfully installed tzinfo-1.2.5
Successfully installed activesupport-5.2.2
Successfully installed rack-2.0.6
Successfully installed rack-test-1.1.0
Successfully installed mini_portile2-2.4.0
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /home/globewalldesk/.rvm/gems/ruby-2.6.0/gems/nokogiri-1.10.1/ext/nokogiri
/usr/share/rvm/rubies/ruby-2.6.0/bin/ruby -I /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0 -r ./siteconf20190116-22693-tbjpnz.rb extconf.rb
checking if the C compiler accepts ... yes
Building nokogiri using packaged libraries.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/share/rvm/rubies/ruby-2.6.0/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
/usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:408:in `block (2 levels) in replace_gem': mini_portile2 is not part of the bundle. Add it to your Gemfile. (Gem::LoadError)
from extconf.rb:469:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/globewalldesk/.rvm/gems/ruby-2.6.0/extensions/x86_64-linux/2.6.0/nokogiri-1.10.1/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/globewalldesk/.rvm/gems/ruby-2.6.0/gems/nokogiri-1.10.1 for inspection.
Results logged to /home/globewalldesk/.rvm/gems/ruby-2.6.0/extensions/x86_64-linux/2.6.0/nokogiri-1.10.1/gem_make.out
Я просмотрел инструкции по установке и много похожих вопросов здесь и в других местах, и перепробовал кучу вещей, но ничего не получается.
Я получаю похожее сообщение об ошибке при попытке gem install nokogiri
.
Помощь!
ОБНОВЛЕНИЕ: Вот файл mkmf.log:
"gcc -o conftest -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/x86_64-linux -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/backward -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0 -I. -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -fPIC conftest.c -L. -L/usr/share/rvm/rubies/ruby-2.6.0/lib -Wl,-rpath,/usr/share/rvm/rubies/ruby-2.6.0/lib -L. -fstack-protector-strong -rdynamic -Wl,-export-dynamic -Wl,-rpath,/usr/share/rvm/rubies/ruby-2.6.0/lib -L/usr/share/rvm/rubies/ruby-2.6.0/lib -lruby -lm -lc "
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main(int argc, char **argv)
4: {
5: return 0;
6: }
/* end */
"gcc -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/x86_64-linux -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0/ruby/backward -I/usr/share/rvm/rubies/ruby-2.6.0/include/ruby-2.6.0 -I. -O3 -ggdb3 -Wall -Wextra -Wdeclaration-after-statement -Wdeprecated-declarations -Wduplicated-cond -Wimplicit-function-declaration -Wimplicit-int -Wmisleading-indentation -Wpointer-arith -Wrestrict -Wwrite-strings -Wimplicit-fallthrough=0 -Wmissing-noreturn -Wno-cast-function-type -Wno-constant-logical-operand -Wno-long-long -Wno-missing-field-initializers -Wno-overlength-strings -Wno-packed-bitfield-compat -Wno-parentheses-equality -Wno-self-assign -Wno-tautological-compare -Wno-unused-parameter -Wno-unused-value -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wunused-variable -fPIC -Werror -c conftest.c"
checked program was:
/* begin */
1: #include "ruby.h"
2:
3: int main() {return 0;}
/* end */
ОБНОВЛЕНИЕ 2: Следуя советам Хавьера, я просмотрел документы по установке Nokogiri и нашел команду gem install nokogiri -- --use-system-libraries
, которая сработала. Затем я сделал то же самое для рельсов и рельсов.
Теперь я получаю другое сообщение об ошибке при попытке запустить rails new
:
Traceback (most recent call last):
2: from /home/globewalldesk/.rvm/gems/ruby-2.6.0/bin/rails:23:in `<main>'
1: from /usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:482:in `block in replace_bin_path'
/usr/share/rvm/rubies/ruby-2.6.0/lib/ruby/2.6.0/bundler/rubygems_integration.rb:462:in `block in replace_bin_path': can't find executable rails for gem railties. railties is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
O
ОБНОВЛЕНИЕ 3:
Я принял ответ Хавьера. Я работал со свежей установкой (попыткой), поэтому не имеет значения, начинаю ли я полностью заново. Я не знаю, что в итоге испортило мою систему (возможно, потому что я скопировал старый файл .bashrc из другой системы, не удалив сначала строки rvm?), Но полностью удалил все Ruby, Rails, другие гемы и rvm и переустановил должен решить проблему.
ОБНОВИТЬ ПОСЛЕДНЮЮ:
Чтобы полностью удалить Ruby, Rails и особенно RVM, потребовалось немало времени. Я не осознавал, насколько важны скрипты профиля Bash, или что строки о RVM должны быть полностью удалены из них, или насколько важно состояние определенных переменных среды, установленных RVM. Я думаю, что главная причина, по которой у меня возникли проблемы с установкой Rails, была просто в том, что я скопировал настройки RVM из моих старых профилей bash. Я должен был удалить их.
Теперь все работает как положено.