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

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

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

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

Q&A

解決済

1回答

1873閲覧

rails サーバーが起動しない

kiyomasa

総合スコア40

Ruby on Rails

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

0グッド

0クリップ

投稿2021/02/06 04:54

#rails のサーバーが立たない

VSコードを利用したrails でローカル環境構築をしたいのですが
rails s実行後サーバーが立たず以下のエラーが発生してしまいます
###エラー内容

console

1$ rails s 2/Users/xxxxxxx/Desktop/portfolio_rails/price_app/price_app/bin/spring:7:in `<top (required)>': undefined method `specs' for nil:NilClass (NoMethodError) 3 from bin/rails:2:in `load' 4 from bin/rails:2:in `<main>'

どうやらspringファイルの7行目がおかしいようで見てみると

spring

1 2#!/usr/bin/env ruby 3if !defined?(Spring) && [nil, "development", "test"].include?(ENV["RAILS_ENV"]) 4 gem "bundler" 5 require "bundler" 6 7 # Load Spring without loading other gems in the Gemfile, for speed. 8 Bundler.locked_gems.specs.find { |spec| spec.name == "spring" }&.tap do |spring| 9 Gem.use_paths Gem.dir, Bundler.bundle_path.to_s, *Gem.path 10 gem "spring", spring.version 11 require "spring/binstub" 12 rescue Gem::LoadError 13 # Ignore when Spring is not installed. 14 end 15end

全く読めません。。

###試したこと 心あたりがあること
Gemfileの記述は

Gemfile

1source 'https://rubygems.org' 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4ruby '3.0.0' 5 6# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 7gem 'rails', '~> 6.1.1' 8# Use sqlite3 as the database for Active Record 9gem 'sqlite3', '~> 1.4' 10# Use Puma as the app server 11gem 'puma', '~> 5.0' 12# Use SCSS for stylesheets 13gem 'sass-rails', '>= 6' 14# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker 15gem 'webpacker', '~> 5.0' 16# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 17gem 'turbolinks', '~> 5' 18# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 19gem 'jbuilder', '~> 2.7' 20# Use Redis adapter to run Action Cable in production 21# gem 'redis', '~> 4.0' 22# Use Active Model has_secure_password 23# gem 'bcrypt', '~> 3.1.7' 24 25# Use Active Storage variant 26# gem 'image_processing', '~> 1.2' 27 28# Reduces boot times through caching; required in config/boot.rb 29gem 'bootsnap', '>= 1.4.4', require: false 30 31group :development, :test do 32 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 33 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 34end 35 36group :development do 37 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 38 gem 'web-console', '>= 4.1.0' 39 # Display performance information such as SQL time and flame graphs for each request in your browser. 40 # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md 41 gem 'rack-mini-profiler', '~> 2.0' 42 gem 'listen', '~> 3.3' 43 # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring 44 gem 'spring' 45end 46 47group :test do 48 # Adds support for Capybara system testing and selenium driver 49 gem 'capybara', '>= 3.26' 50 gem 'selenium-webdriver' 51 # Easy installation and use of web drivers to run system tests with browsers 52 gem 'webdrivers' 53end 54 55# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 56gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 57

で初期設定から特にいじっていませんが、この状態でbundle installを実行すると、VSコードターミナル上に以下のエラーが表示され、やはりよくわかりませんでした。

--- TEMPLATE END ---------------------------------------------------------------- Unfortunately, an unexpected error occurred, and Bundler cannot continue. First, try this link to see if there are any existing issue reports for this error: https://github.com/rubygems/rubygems/search?q=Operation+not+permitted+%40+apply2files+-+%2FUsers%2Fkiyomasa%2F.rbenv%2Fversions%2F3.0.0%2Flib%2Fruby%2Fgems%2F3.0.0%2Fgems%2Frails-6.1.1%2FREADME.md&type=Issues If there aren't any reports for this error yet, please create copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at: https://github.com/rubygems/rubygems/issues/new?labels=Bundler

###補足情報 version

ruby -v ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-darwin19] rails -v Rails 6.1.1

よろしくお願いします。。。

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

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

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

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

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

guest

回答1

0

ベストアンサー

古いモデルにそういったバグが報告されているようですが、
bundlerのバージョンが古い(1.9.0~1.9.3あたり?)のではないでしょうか?

バージョン確認用コマンド

gem list bundler

rubyのバージョンなどにも依存するため、
どのbundlerにあげるべきかは、
ご自身にてご判断いただければと思います。

参考1
https://qiita.com/SaitoJP/items/b4c06f4cb765896c6b57

参考2
https://stackoverflow.com/questions/33733476/nomethoderror-undefined-method-spec-for-nilnilclass-active-utils-factory/36453190

投稿2021/02/06 06:48

WhiteTempest

総合スコア404

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

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

kiyomasa

2021/02/06 08:36

ご回答ありがとうございます。 いただいたコマンド実行し確認したところ bundlerのバージョンは *** LOCAL GEMS *** bundler (2.2.8, default: 2.2.3) でしたのでどうやら原因は異なるようです。 参考サイトを確認させていただき一応 gem updateをしたのですが解決しませんでした。。。。 もう少し調査いたします。
WhiteTempest

2021/02/06 08:56

bundle installのエラーに operation not permitted が見受けられます。 linux系であればsudoで、 Windows系であれば管理者権限のコマンドプロンプトで、 権限が強いユーザーで実施することで現象変化するかもしれません。 ※私も最近Windows上で Ruby on Railsの環境構築してますが、 難儀してます。。。 お互い頑張りましょう! ご参考までに。
kiyomasa

2021/02/06 11:39

ありがとうございます。 なるほど、、、権限問題だったのかもしれませんね。 今ほど一旦全てフォルダを作り直し、Railsチュートリアル の環境でrails のバージョンを rails -v Rails 6.0.3.4 に下げて再度構築したらなぜかできるようになりました。 ありがとうございました、、、 頑張りましょう!!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.46%

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

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

質問する

関連した質問