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

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

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

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

Q&A

解決済

1回答

3424閲覧

rails new でエラーが出るが対処法がわからない

story_aniki

総合スコア197

Ruby on Rails

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

0グッド

0クリップ

投稿2019/12/13 08:10

編集2019/12/13 09:28

rails new を実施したところエラーが出てうまくいかないです

やりたいこと  エラーを解消しrails newをだたしく起動させたい

[vagrant@localhost rails_lessons]$ rails new my_memo create create README.md create Rakefile : : create tmp/storage create tmp/storage/.keep remove config/initializers/cors.rb remove config/initializers/new_framework_defaults_6_0.rb run bundle install The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`. Fetching gem metadata from https://rubygems.org/............ Fetching gem metadata from https://rubygems.org/. Resolving dependencies...... Using rake 13.0.1 Using concurrent-ruby 1.1.5 : : Using sassc-rails 2.1.2 Using sass-rails 6.0.0 Using selenium-webdriver 3.142.6 Using spring 2.1.0 Using spring-watcher-listen 2.0.1 Fetching sqlite3 1.4.1 Installing sqlite3 1.4.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension. current directory: /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.1/ext/sqlite3 /home/vagrant/.rbenv/versions/2.6.5/bin/ruby -I /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/2.6.0 -r ./siteconf20191213-24129-14tuj2s.rb extconf.rb checking for sqlite3.h... no sqlite3.h is missing. Try 'brew install sqlite3', 'yum install sqlite-devel' or 'apt-get install libsqlite3-dev' and check your shared library search path (the location where your sqlite3 shared library is located). *** 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-sqlite3-include --without-sqlite3-include=${sqlite3-dir}/include --with-sqlite3-lib --without-sqlite3-lib=${sqlite3-dir}/lib To see why this extension failed to compile, please check the mkmf.log which can be found here: /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/sqlite3-1.4.1/mkmf.log extconf failed, exit code 1 Gem files will remain installed in /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/gems/sqlite3-1.4.1 for inspection. Results logged to /home/vagrant/.rbenv/versions/2.6.5/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0/sqlite3-1.4.1/gem_make.out An error occurred while installing sqlite3 (1.4.1), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.4.1' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: sqlite3 run bundle binstubs bundler Could not find gem 'sqlite3 (~> 1.4)' in any of the gem sources listed in your Gemfile. run bundle exec spring binstub --all Could not find gem 'sqlite3 (~> 1.4)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems. rails webpacker:install Could not find gem 'sqlite3 (~> 1.4)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.

恐らく重要なのは

The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.

Fetching sqlite3 1.4.1 Installing sqlite3 1.4.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

An error occurred while installing sqlite3 (1.4.1), and Bundler cannot continue. Make sure that `gem install sqlite3 -v '1.4.1' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: sqlite3 run bundle binstubs bundler Could not find gem 'sqlite3 (~> 1.4)' in any of the gem sources listed in your Gemfile. run bundle exec spring binstub --all Could not find gem 'sqlite3 (~> 1.4)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems. rails webpacker:install Could not find gem 'sqlite3 (~> 1.4)' in any of the gem sources listed in your Gemfile. Run `bundle install` to install missing gems.

の3か所の記述のところだと思われるのですが
①に関しては全く原因と対処法が思い浮かびません
②③にかんしてはaqliteのバージョンが違うという事だと思うのですが、gem fileを書き換えて

gem 'sqlite3', '~> 1.4'

gem 'sqlite3', '~> 1.4.1'

に書き換えて試すことも試みましたがうまくいきませんでした
原因や解決法を教えていただければと思います

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

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

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

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

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

guest

回答1

0

ベストアンサー

exist identical README.md identical Rakefile

というエラーからみて、同じアプリケーション名でやっていませんか?
あるdirには同じアプリケーション名では作製できません。
名前を変えるか、別のdirで行うかして下さい

sqlite3関連でのcompileに失敗しています

Installing sqlite3 1.4.1 with native extensions Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

ですので、
Check the mkmf.log file for more details. You may need configuration options.
と言ってますので、mkmf.logを見て下さい。
少なくとも一つは
sqlite3.h is missing.とあります。

Try 'brew install sqlite3', 'yum install sqlite-devel' or 'apt-get install libsqlite3-dev' and check your shared library search path (the location where your sqlite3 shared library is located).

と指示がありますから、これを行いましょう

投稿2019/12/13 08:17

編集2019/12/13 10:17
winterboum

総合スコア23329

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

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

story_aniki

2019/12/13 09:31

回答ありがとうございます 実は最初にエラーが出て、おっしゃる通りもう一度同じ名前でrails newを不適切に行ってしまいました ただ、エラーが出ることは間違いがないので、もう一度フォルダを削除してから新しくrails newをしてみました 質問文中のコーどの部分も修正しましたので、もし原因がわかればご回答お願いします
story_aniki

2019/12/13 10:28

ありがとうございます! 無事に解決しました 対策がこんなに素直にエラー文の中に書いてあるのですね また一つ勉強になりました
winterboum

2019/12/13 10:31

エラーメッセージは宝です
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問