Railsチュートリアル第6版を参考にherokuにrailsアプリをデプロイすると、以下のエラーが発生しました。
webpackやnodeのコンフリクトでエラーが起きているのかと思いますが、エラー内容で検索しても該当のものが見当たらないため、解決方法を教えていただきたいです。
ローカル環境
- macOS Big Sur 11.2.3
- ruby 2.6.3
- Rails 6.0.3
- Bundler 1.17.2
- yarn 1.22.10
- npm 7.7.6
##エラー内容
$git push heroku master 略 remote: Bundle completed (38.81s) remote: Cleaning up the bundler cache. remote: -----> Installing node-v12.16.2-linux-x64 remote: -----> Installing yarn-v1.22.4 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: yarn install v1.22.4 remote: [1/4] Resolving packages... remote: [2/4] Fetching packages... remote: info fsevents@1.2.13: The platform "linux" is incompatible with this module. remote: info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation. remote: [3/4] Linking dependencies... remote: warning " > webpack-dev-server@3.11.2" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". remote: warning "webpack-dev-server > webpack-dev-middleware@3.7.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0". remote: [4/4] Building fresh packages... remote: Done in 15.90s. remote: I, [2021-04-14T14:16:56.255745 #1065] INFO -- : Writing /tmp/build_b3c6e1ab/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css remote: I, [2021-04-14T14:16:56.256613 #1065] INFO -- : Writing /tmp/build_b3c6e1ab/public/assets/application-e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.css.gz remote: Compiling… remote: Compilation failed: remote: [webpack-cli] Failed to load '/tmp/build_b3c6e1ab/config/webpack/production.js' config remote: [webpack-cli] TypeError: Cannot read property 'toWebpackConfig' of undefined remote: at Object.<anonymous> (/tmp/build_b3c6e1ab/config/webpack/production.js:5:30) remote: at Module._compile (/tmp/build_b3c6e1ab/node_modules/v8-compile-cache/v8-compile-cache.js:192:30) remote: at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10) remote: at Module.load (internal/modules/cjs/loader.js:1000:32) remote: at Function.Module._load (internal/modules/cjs/loader.js:899:14) remote: at Module.require (internal/modules/cjs/loader.js:1042:19) remote: at require (/tmp/build_b3c6e1ab/node_modules/v8-compile-cache/v8-compile-cache.js:159:20) remote: at loadConfig (/tmp/build_b3c6e1ab/node_modules/webpack-cli/lib/webpack-cli.js:1322:31) remote: at /tmp/build_b3c6e1ab/node_modules/webpack-cli/lib/webpack-cli.js:1409:74 remote: at Array.map (<anonymous>) remote: remote: remote: ! remote: ! Precompiling assets failed. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to xxxx. remote:
#Gemfile
source 'https://rubygems.org' git_source(:github) { |repo| "https://github.com/#{repo}.git" } gem 'rails', '6.0.3' gem 'puma', '4.3.6' gem 'sass-rails', '5.1.0' gem 'webpacker', '4.0.7' gem 'turbolinks', '5.2.0' gem 'jbuilder', '2.9.1' gem 'bootsnap', '1.4.5', require: false group :development, :test do gem 'sqlite3', '1.4.1' gem 'byebug', '11.0.1', platforms: [:mri, :mingw, :x64_mingw] end group :development do gem 'web-console', '4.0.1' gem 'listen', '3.1.5' gem 'spring', '2.1.0' gem 'spring-watcher-listen', '2.0.1' end group :test do gem 'capybara', '3.28.0' gem 'selenium-webdriver', '3.142.4' gem 'webdrivers', '4.1.2' end group :production do gem 'pg', '1.1.4' end
#package.json
{ "name": "StretchTimer", "private": true, "dependencies": { "@rails/actioncable": "^6.0.0", "@rails/activestorage": "^6.0.0", "@rails/ujs": "^6.0.0", "@rails/webpacker": "^6.0.0-beta.6", "turbolinks": "^5.2.0" }, "version": "0.1.0", "devDependencies": { "webpack-dev-server": "^3.11.2" } }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/04/15 10:07