質問編集履歴

2 コード修正

story_aniki

story_aniki score 187

2019/12/13 18:28  投稿

rails new でエラーが出るが対処法がわからない
rails new を実施したところエラーが出てうまくいかないです
**やりたいこと  エラーを解消しrails newをだたしく起動させたい**
```ここに言語を入力
[vagrant@localhost rails_lessons]$ rails new my_memo
      exist
  identical README.md
  identical Rakefile
  identical .ruby-version
  identical config.ru
   conflict .gitignore
Overwrite /home/vagrant/rails_lessons/my_memo/.gitignore? (enter "h" for help) [Ynaqdhm] y
      force .gitignore
  identical Gemfile
        run git init from "."
Reinitialized existing Git repository in /home/vagrant/rails_lessons/my_memo/.git/
  identical package.json
      exist app
  identical app/assets/config/manifest.js
[vagrant@localhost rails_lessons]$ rails new my_memo
     create
     create README.md
     create Rakefile
           :
          :
  identical storage/.keep
      exist tmp/storage
  identical tmp/storage/.keep
           :
     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 i18n 1.7.0
        :
        :
          :
          :
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-23842-o94i86.rb extconf.rb
./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
              :
              :
       --without-sqlcipher
       --with-sqlite3-config
       --without-sqlite3-config
       --with-pkg-config
       --without-pkg-config
       --with-sqlcipher
       --without-sqlcipher
       --with-sqlite3-dir
       --without-sqlite3-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'
```
に書き換えて試すことも試みましたがうまくいきませんでした
原因や解決法を教えていただければと思います
  • Ruby on Rails

    15912 questions

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

1 余分なコードの削除

story_aniki

story_aniki score 187

2019/12/13 17:13  投稿

rails new でエラーが出るが対処法がわからない
rails new を実施したところエラーが出てうまくいかないです
**やりたいこと  エラーを解消しrails newをだたしく起動させたい**
```ここに言語を入力
[vagrant@localhost rails_lessons]$ rails new my_memo
      exist
  identical README.md
  identical Rakefile
  identical .ruby-version
  identical config.ru
   conflict .gitignore
Overwrite /home/vagrant/rails_lessons/my_memo/.gitignore? (enter "h" for help) [Ynaqdhm] y
      force .gitignore
  identical Gemfile
        run git init from "."
Reinitialized existing Git repository in /home/vagrant/rails_lessons/my_memo/.git/
  identical package.json
      exist app
  identical app/assets/config/manifest.js
           :
          :
  identical storage/.keep
      exist tmp/storage
  identical 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 i18n 1.7.0
        :
        :
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-23842-o94i86.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-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=/home/vagrant/.rbenv/versions/2.6.5/bin/$(RUBY_BASE_NAME)
       --with-sqlcipher
              :
              :
       --without-sqlcipher
       --with-sqlite3-config
       --without-sqlite3-config
       --with-pkg-config
       --without-pkg-config
       --with-sqlcipher
       --without-sqlcipher
       --with-sqlite3-dir
       --without-sqlite3-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'
```
に書き換えて試すことも試みましたがうまくいきませんでした
原因や解決法を教えていただければと思います
  • Ruby on Rails

    15912 questions

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

思考するエンジニアのためのQ&Aサイト「teratail」について詳しく知る