自動デプロイをする時にwebpackerに関するエラーが発生してしまいます
Vue.jsを導入しようとこちらでwebpackerをインストールしました。
試しにGemfileのwebpackerをコメントアウトしてみるとデプロイは成功するので、webpackerが原因だと思っています
よろしくお願いします
この質問はマルチポストです 修正依頼参照
###エラー
NoMethodError: undefined method `strip' for nil:NilClass /var/www/baseball-app/shared/bundle/ruby/2.5.0/bundler/gems/webpacker-31b7a6f31e38/lib/tasks/webpacker/check_yarn.rake:6:in `block (2 levels) in <top (required)>' /var/www/baseball-app/shared/bundle/ruby/2.5.0/bundler/gems/webpacker-31b7a6f31e38/lib/tasks/webpacker/compile.rake:16:in `block in enhance_assets_precompile' /var/www/baseball-app/shared/bundle/ruby/2.5.0/gems/rake-13.0.1/exe/rake:27:in `<top (required)>' /home/ec2-user/.rbenv/versions/2.5.1/bin/bundle:23:in `load' /home/ec2-user/.rbenv/versions/2.5.1/bin/bundle:23:in `<main>' Tasks: TOP => webpacker:compile => webpacker:verify_install => webpacker:check_yarn (See full trace by running task with --trace)
#####Gemfile
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } ruby '2.5.1' # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.2.3' # Use mysql as the database for Active Record gem 'mysql2', '0.5.2' # Use Puma as the app server gem 'puma', '~> 3.11' # Use SCSS for stylesheets gem 'sass-rails', '5.0.7' # Use Uglifier as compressor for JavaScript assets gem 'uglifier', '>= 1.3.0' # See https://github.com/rails/execjs#readme for more supported runtimes # gem 'mini_racer', platforms: :ruby # Use CoffeeScript for .coffee assets and views gem 'coffee-rails', '~> 4.2' # Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks gem 'turbolinks', '~> 5' # Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder gem 'jbuilder', '~> 2.5' # Use Redis adapter to run Action Cable in production # gem 'redis', '~> 4.0' # Use ActiveModel has_secure_password # gem 'bcrypt', '~> 3.1.7' # Use ActiveStorage variant # gem 'mini_magick', '~> 4.8' # Use Capistrano for deployment # gem 'capistrano-rails', group: :development # Reduces boot times through caching; required in config/boot.rb gem 'bootsnap', '>= 1.1.0', require: false group :development, :test do # Call 'byebug' anywhere in the code to stop execution and get a debugger console gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] gem 'capistrano' gem 'capistrano-rbenv' gem 'capistrano-bundler' gem 'capistrano-rails' gem 'capistrano3-unicorn' end group :development do # Access an interactive console on exception pages or by calling 'console' anywhere in the code. gem 'web-console', '>= 3.3.0' gem 'listen', '>= 3.0.5', '< 3.2' # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring gem 'spring' gem 'spring-watcher-listen', '~> 2.0.0' end group :test do # Adds support for Capybara system testing and selenium driver gem 'capybara', '>= 2.15' gem 'selenium-webdriver' # Easy installation and use of chromedriver to run system tests with Chrome gem 'chromedriver-helper' end # Windows does not include zoneinfo files, so bundle the tzinfo-data gem gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] gem 'pry-rails' gem 'compass-rails', '3.1.0' gem 'sprockets', '3.7.2' gem 'kaminari' gem 'jquery-rails' gem "jquery-ui-rails" gem 'fullcalendar-rails' gem 'momentjs-rails' gem 'rails-i18n' gem 'devise' gem 'carrierwave' gem 'mini_magick' gem "font-awesome-sass" gem 'ancestry' gem 'fog' gem 'webpacker', github: 'rails/webpacker' gem 'bootstrap', '~> 5.0.0.alpha2' group :production do gem 'unicorn', '5.4.1' end
###追記
エラー
Tasks: TOP => deploy:assets:precompile (See full trace by running task with --trace) The deploy has failed with an error: Exception while executing as ec2-user@54.168.63.207: rake exit status: 1 rake stdout: yarn install v1.22.10 [1/4] Resolving packages... [2/4] Fetching packages... info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command. Compiling... Compilation failed: yarn run v1.22.10 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. error Command "webpack" not found.
check_yarnでコケていますが、インスタンス内にyarnはインストールしていますか?
はい、Vuetifyをインストールしようとyarnをインストールした記憶があります
結局Vuetifyは使いませんでした
yarn -v
1.22.10
yarn installでインストールしてますがyarnが原因なのでしょうか
webpackerをGithub経由で入れているのはなにか理由があってでしょうか?(RubyGemsの最新版では動作しますか?)
いえ、理由はありませんがGithub経由を止めても以上のエラーが発生します
「yarn -v」はインスタンス内で行ってその結果でしょうか?
ありがとうございます!インスタンス内ではありませんでした。
申し訳ありませんが
error Command "webpack" not found.が発生したのですが、どういう原因が考えられるかご教授お願いできますでしょうか?
「インスタンス内で」yarnをインストールし、yarn installも実行してみてください。
はい、yarnは既にインストールしまして追記のようなエラーが発生しています
うーん、すぐにはわからないですね。
あなたの回答
tips
プレビュー