質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.46%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

2回答

2651閲覧

rubyとgemfileの不一致

moyasi-

総合スコア3

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2021/07/04 01:57

編集2021/07/04 19:23

Linux環境でrailsの構築をしていたところ下記のエラーが出てきてしまいました。

```ここに言語を入力 $ rails s Your Ruby version is 2.7.0, but your Gemfile specified 2.6.1

いろいろと調べてはみたのですが一向に解決しません。
どうかよろしくお願いします。

versionを書き直し、bundle installを実行した結果発生したエラー

$ bundle install Fetching gem metadata from https://rubygems.org/............ Resolving dependencies... Using rake 13.0.3 Following files may not be writable, so sudo is needed: /usr/local/bin /var/lib/gems/2.7.0 /var/lib/gems/2.7.0/build_info /var/lib/gems/2.7.0/cache /var/lib/gems/2.7.0/doc /var/lib/gems/2.7.0/extensions /var/lib/gems/2.7.0/gems /var/lib/gems/2.7.0/specifications Using concurrent-ruby 1.1.9 Using minitest 5.14.4 Using websocket-extensions 0.1.5 Using marcel 1.0.1 Using mini_mime 1.1.0 Using erubi 1.10.0 Using public_suffix 4.0.6 Using zeitwerk 2.4.2 Using bundler 2.2.21 Fetching msgpack 1.4.2 Fetching bindex 0.8.1 Using crass 1.0.6 Using regexp_parser 2.1.1 Using childprocess 3.0.0 Fetching nio4r 2.5.7 Using builder 3.2.4 Using rb-fsevent 0.11.0 Using method_source 1.0.0 Using thor 1.1.0 Using rubyzip 2.3.0 Using tilt 2.0.10 Using semantic_range 3.0.0 Fetching racc 1.5.2 Fetching byebug 11.1.3 Fetching ffi 1.15.3 Using rack 2.2.3 Using sqlite3 1.4.2 Using turbolinks-source 5.2.0 Using spring 2.1.1 Using tzinfo 2.0.4 Using i18n 1.8.10 Using mail 2.7.1 Using addressable 2.7.0 Using selenium-webdriver 3.142.7 Using rack-test 1.1.0 Using rack-mini-profiler 2.3.2 Fetching websocket-driver 0.7.5 Using rack-proxy 0.7.0 Using sprockets 4.0.2 Using turbolinks 5.2.1 Using activesupport 6.1.4 Using globalid 0.4.2 Using activemodel 6.1.4 Using jbuilder 2.11.2 Using activejob 6.1.4 Using activerecord 6.1.4 Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run: bundle config set --local path 'vendor/bundle' bundle install to install the gems into ./vendor/bundle/, or you can enter your password and install the bundled gems to RubyGems using sudo. Password: Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run: bundle config set --local path 'vendor/bundle' bundle install to install the gems into ./vendor/bundle/, or you can enter your password and install the bundled gems to RubyGems using sudo. Password: Installing bindex 0.8.1 with native extensions Installing websocket-driver 0.7.5 with native extensions Installing byebug 11.1.3 with native extensions Installing nio4r 2.5.7 with native extensions Installing msgpack 1.4.2 with native extensions Installing racc 1.5.2 with native extensions Installing ffi 1.15.3 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /tmp/bundler20210705-1059-gzagzeracc-1.5.2/gems/racc-1.5.2/ext/racc/cparse /usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20210705-1059-1gdcw6r.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. extconf failed, exit code 1 Gem files will remain installed in /tmp/bundler20210705-1059-gzagzeracc-1.5.2/gems/racc-1.5.2 for inspection. Results logged to /tmp/bundler20210705-1059-gzagzeracc-1.5.2/extensions/x86_64-linux/2.7.0/racc-1.5.2/gem_make.out An error occurred while installing racc (1.5.2), and Bundler cannot continue. Make sure that `gem install racc -v '1.5.2' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 6.1.4, which depends on actioncable was resolved to 6.1.4, which depends on actionpack was resolved to 6.1.4, which depends on actionview was resolved to 6.1.4, which depends on rails-dom-testing was resolved to 2.0.3, which depends on nokogiri was resolved to 1.11.7, which depends on racc Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /tmp/bundler20210705-1059-gkp5h8nio4r-2.5.7/gems/nio4r-2.5.7/ext/nio4r /usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20210705-1059-5l87mg.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. extconf failed, exit code 1 Gem files will remain installed in /tmp/bundler20210705-1059-gkp5h8nio4r-2.5.7/gems/nio4r-2.5.7 for inspection. Results logged to /tmp/bundler20210705-1059-gkp5h8nio4r-2.5.7/extensions/x86_64-linux/2.7.0/nio4r-2.5.7/gem_make.out An error occurred while installing nio4r (2.5.7), and Bundler cannot continue. Make sure that `gem install nio4r -v '2.5.7' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 6.1.4, which depends on actioncable was resolved to 6.1.4, which depends on nio4r Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /tmp/bundler20210705-1059-x387udwebsocket-driver-0.7.5/gems/websocket-driver-0.7.5/ext/websocket-driver /usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20210705-1059-u3wati.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. extconf failed, exit code 1 Gem files will remain installed in /tmp/bundler20210705-1059-x387udwebsocket-driver-0.7.5/gems/websocket-driver-0.7.5 for inspection. Results logged to /tmp/bundler20210705-1059-x387udwebsocket-driver-0.7.5/extensions/x86_64-linux/2.7.0/websocket-driver-0.7.5/gem_make.out An error occurred while installing websocket-driver (0.7.5), and Bundler cannot continue. Make sure that `gem install websocket-driver -v '0.7.5' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: rails was resolved to 6.1.4, which depends on actioncable was resolved to 6.1.4, which depends on websocket-driver Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /tmp/bundler20210705-1059-qzsws5bindex-0.8.1/gems/bindex-0.8.1/ext/skiptrace /usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20210705-1059-1a7r67v.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. extconf failed, exit code 1 Gem files will remain installed in /tmp/bundler20210705-1059-qzsws5bindex-0.8.1/gems/bindex-0.8.1 for inspection. Results logged to /tmp/bundler20210705-1059-qzsws5bindex-0.8.1/extensions/x86_64-linux/2.7.0/bindex-0.8.1/gem_make.out An error occurred while installing bindex (0.8.1), and Bundler cannot continue. Make sure that `gem install bindex -v '0.8.1' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: web-console was resolved to 4.1.0, which depends on bindex Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /tmp/bundler20210705-1059-otqpqimsgpack-1.4.2/gems/msgpack-1.4.2/ext/msgpack /usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20210705-1059-17xxby8.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. extconf failed, exit code 1 Gem files will remain installed in /tmp/bundler20210705-1059-otqpqimsgpack-1.4.2/gems/msgpack-1.4.2 for inspection. Results logged to /tmp/bundler20210705-1059-otqpqimsgpack-1.4.2/extensions/x86_64-linux/2.7.0/msgpack-1.4.2/gem_make.out An error occurred while installing msgpack (1.4.2), and Bundler cannot continue. Make sure that `gem install msgpack -v '1.4.2' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: bootsnap was resolved to 1.7.5, which depends on msgpack Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /tmp/bundler20210705-1059-tdyhiqbyebug-11.1.3/gems/byebug-11.1.3/ext/byebug /usr/bin/ruby2.7 -I /usr/lib/ruby/2.7.0 -r ./siteconf20210705-1059-m03g8z.rb extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h You might have to install separate package for the ruby development environment, ruby-dev or ruby-devel for example. extconf failed, exit code 1 Gem files will remain installed in /tmp/bundler20210705-1059-tdyhiqbyebug-11.1.3/gems/byebug-11.1.3 for inspection. Results logged to /tmp/bundler20210705-1059-tdyhiqbyebug-11.1.3/extensions/x86_64-linux/2.7.0/byebug-11.1.3/gem_make.out An error occurred while installing byebug (11.1.3), and Bundler cannot continue. Make sure that `gem install byebug -v '11.1.3' --source 'https://rubygems.org/'` succeeds before bundling.

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

自己解決

どうやっても解決できなかったので一から構築しなおしました。

投稿2021/07/06 21:34

moyasi-

総合スコア3

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

Gemfile に従って 2.6.1 で実行するのでしたら rbenvなどで2.6.1が動く環境にしてください
2.7.0 でやるのなら Gemfile に書かれている rubyuのversionを 2.7.0 にしてbundle installしましょう

投稿2021/07/04 02:38

winterboum

総合スコア23401

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

moyasi-

2021/07/04 19:24

gemfailを書き直しbundle installを実行したところ新たなエラーが発生してしまいました。
winterboum

2021/07/04 22:00

ああ、載ってた、ちとまって
winterboum

2021/07/04 22:02

Your user account isn't allowed to install to the system RubyGems. You can cancel this installation and run: bundle config set --local path 'vendor/bundle' bundle install と有りますね。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.46%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問