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

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

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

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

Q&A

解決済

1回答

693閲覧

railsサーバー起動時に、nokogiriエラーが発生する(bundle installは成功)

penguin123

総合スコア16

Ruby on Rails

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

0グッド

0クリップ

投稿2020/03/19 18:33

前提・実現したいこと

rails newを行い、bundle installが終了して
試しにサーバーを立ち上げようとするとwebpackerのエラーが発生し、

https://qiita.com/libertyu/items/1eb74adc817ab8971100

こちらの記事を参考に直そうとすると別のエラーがでました。(②)

発生している問題・エラーメッセージ

①のエラー

$ bundle exec rails server => Booting Puma => Rails 6.0.2.2 application starting in development => Run `rails server --help` for more startup options Exiting Traceback (most recent call last): 略 /Users/app/vendor/bundle/ruby/2.6.0/gems/webpacker-4.2.2/lib/webpacker/configuration.rb:92:in `read': No such file or directory @ rb_sysopen - /Users/app/config/webpacker.yml (Errno::ENOENT) 略 /Users/app/vendor/bundle/ruby/2.6.0/gems/webpacker-4.2.2/lib/webpacker/configuration.rb:95:in `rescue in load': Webpacker configuration file not found /Users/app/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /Users/app/config/webpacker.yml (RuntimeError)

②のエラー

$ rails webpacker:install Could not find nokogiri-1.10.9 in any of the sources Run `bundle install` to install missing gems.

該当のソースコード

Ruby on Rails 2.6.3

試したこと

nokogiri系のエラーはネットを見ているとbundle installの実行時に起こることが多いみたいでサーバー起動時のものを発見できませんでした。
何個か、bundle installの記事を見ながら行いましたが解決しませんでした。

bundle installの結果

$ 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`. Using rake 13.0.1 Using concurrent-ruby 1.1.6 Using i18n 1.8.2 Using minitest 5.14.0 Using thread_safe 0.3.6 Using tzinfo 1.2.6 Using zeitwerk 2.3.0 Using activesupport 6.0.2.2 Using builder 3.2.4 Using erubi 1.9.0 Using mini_portile2 2.4.0 Using nokogiri 1.10.9 Using rails-dom-testing 2.0.3 Using crass 1.0.6 Using loofah 2.4.0 Using rails-html-sanitizer 1.3.0 Using actionview 6.0.2.2 Using rack 2.2.2 Using rack-test 1.1.0 Using actionpack 6.0.2.2 Using nio4r 2.5.2 Using websocket-extensions 0.1.4 Using websocket-driver 0.7.1 Using actioncable 6.0.2.2 Using globalid 0.4.2 Using activejob 6.0.2.2 Using activemodel 6.0.2.2 Using activerecord 6.0.2.2 Using mimemagic 0.3.4 Using marcel 0.3.3 Using activestorage 6.0.2.2 Using mini_mime 1.0.2 Using mail 2.7.1 Using actionmailbox 6.0.2.2 Using actionmailer 6.0.2.2 Using actiontext 6.0.2.2 Using bindex 0.8.1 Using msgpack 1.3.3 Using bootsnap 1.4.6 Using bundler 2.1.2 Using byebug 11.1.1 Using ffi 1.12.2 Using jbuilder 2.10.0 Using rb-fsevent 0.10.3 Using rb-inotify 0.10.1 Using ruby_dep 1.5.0 Using listen 3.1.5 Using method_source 1.0.0 Using mysql2 0.5.3 Using puma 4.3.3 Using rack-proxy 0.6.5 Using thor 1.0.1 Using railties 6.0.2.2 Using sprockets 4.0.0 Using sprockets-rails 3.2.1 Using rails 6.0.2.2 Using sassc 2.2.1 Using tilt 2.0.10 Using sassc-rails 2.1.2 Using sass-rails 6.0.0 Using spring 2.1.0 Using spring-watcher-listen 2.0.1 Using web-console 4.0.1 Using webpacker 4.2.2 Bundle complete! 13 Gemfile dependencies, 64 gems now installed. Bundled gems are installed into `./vendor/bundle`

brew doctorで解決した記事があったので、実行してみましたがこれというものは得られませんでした。

$ brew doctor Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry or file an issue; just ignore this. Thanks! Warning: Homebrew's sbin was not found in your PATH but you have installed formulae that put executables in /usr/local/sbin. Consider setting the PATH for example like so: echo 'export PATH="/usr/local/sbin:$PATH"' >> ~/.bash_profile

.bash_profileの中身

export PATH="$HOME/.rbenv/bin:$PATH" if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi export PATH="$HOME/.rbenv/bin:$PATH" export PATH="/usr/local/sbin:$PATH"

よろしくお願いします。

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

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

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

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

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

guest

回答1

0

ベストアンサー

Homebrewとrbenvを利用しているなら、以下のPATHの設定が必要です。
あなたが利用しているシェルがBashなら.bash_profile、Zshなら.zprofile
に追加してください。

(.bash_profileまたは.zprofile)
export PATH=/usr/local/opt:${PATH}
export PATH=/usr/local/bin:${PATH}
export PATH=/usr/local/sbin:${PATH}
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi

webpackerを利用するにはyarnが必要ですのでインストールしてください。
$ brew install yarn

投稿2020/03/19 23:56

technocore

総合スコア7225

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

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

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問