デプロイの際にエラーが発生しており解決したい
こんにちは
Rubyで簡単な画像投稿アプリを作成しております。
デプロイする際にエラーが発生しており解決方法をご教授いただけますと幸いです。
発生しているエラー
(herokuにプッシュする際のターミナル上のエラー)
remote: ERROR in ./app/javascript/packs/application.js remote: Module build failed (from ./node_modules/babel-loader/lib/index.js): remote: Error: /tmp/build_32a448aa/babel.config.js: Configuration should be an exported JavaScript object. remote: at readConfigJS (/tmp/build_32a448aa/node_modules/@babel/core/lib/config/files/configuration.js:193:11) remote: at readConfigJS.next (<anonymous>) remote: at Function.<anonymous> (/tmp/build_32a448aa/node_modules/@babel/core/lib/gensync-utils/async.js:16:3) remote: at Generator.next (<anonymous>) remote: at step (/tmp/build_32a448aa/node_modules/gensync/index.js:261:32) remote: at evaluateAsync (/tmp/build_32a448aa/node_modules/gensync/index.js:291:5) remote: at Function.errback (/tmp/build_32a448aa/node_modules/gensync/index.js:113:7) remote: at errback (/tmp/build_32a448aa/node_modules/@babel/core/lib/gensync-utils/async.js:60:18) remote: at async (/tmp/build_32a448aa/node_modules/gensync/index.js:188:31) remote: at onFirstPause (/tmp/build_32a448aa/node_modules/gensync/index.js:216:13) remote: at Generator.next (<anonymous>) remote: at cachedFunction (/tmp/build_32a448aa/node_modules/@babel/core/lib/config/caching.js:58:46) remote: at cachedFunction.next (<anonymous>) remote: at step (/tmp/build_32a448aa/node_modules/gensync/index.js:269:25) remote: at evaluateAsync (/tmp/build_32a448aa/node_modules/gensync/index.js:291:5) remote: at /tmp/build_32a448aa/node_modules/gensync/index.js:44:11 remote: at Array.forEach (<anonymous>) remote: at Function.async (/tmp/build_32a448aa/node_modules/gensync/index.js:43:15) remote: at Function.all (/tmp/build_32a448aa/node_modules/gensync/index.js:216:13) remote: at Generator.next (<anonymous>) remote: at loadOneConfig (/tmp/build_32a448aa/node_modules/@babel/core/lib/config/files/configuration.js:108:34) remote: at loadOneConfig.next (<anonymous>) remote: at buildRootChain (/tmp/build_32a448aa/node_modules/@babel/core/lib/config/config-chain.js:68:51) remote: at buildRootChain.next (<anonymous>) remote: at loadPrivatePartialConfig (/tmp/build_32a448aa/node_modules/@babel/core/lib/config/partial.js:85:62) remote: at loadPrivatePartialConfig.next (<anonymous>) remote: at /tmp/build_32a448aa/node_modules/@babel/core/lib/config/partial.js:131:25 remote: at Generator.next (<anonymous>) remote: at step (/tmp/build_32a448aa/node_modules/gensync/index.js:269:25) remote: at evaluateAsync (/tmp/build_32a448aa/node_modules/gensync/index.js:291:5) remote: remote: remote: ! remote: ! Precompiling assets failed. remote: ! remote: ! Push rejected, failed to compile
(herokuのBildログ上でのエラー)
ERROR in ./app/javascript/packs/application.js Module build failed (from ./node_modules/babel-loader/lib/index.js): Error: /tmp/build_c2f299eb/babel.config.js: Configuration should be an exported JavaScript object. at readConfigJS (/tmp/build_c2f299eb/node_modules/@babel/core/lib/config/files/configuration.js:193:11) at readConfigJS.next (<anonymous>) at Function.<anonymous> (/tmp/build_c2f299eb/node_modules/@babel/core/lib/gensync-utils/async.js:16:3) at Generator.next (<anonymous>) at step (/tmp/build_c2f299eb/node_modules/gensync/index.js:261:32) at evaluateAsync (/tmp/build_c2f299eb/node_modules/gensync/index.js:291:5) at Function.errback (/tmp/build_c2f299eb/node_modules/gensync/index.js:113:7) at errback (/tmp/build_c2f299eb/node_modules/@babel/core/lib/gensync-utils/async.js:60:18) at async (/tmp/build_c2f299eb/node_modules/gensync/index.js:188:31) at onFirstPause (/tmp/build_c2f299eb/node_modules/gensync/index.js:216:13) at Generator.next (<anonymous>) at cachedFunction (/tmp/build_c2f299eb/node_modules/@babel/core/lib/config/caching.js:58:46) at cachedFunction.next (<anonymous>) at step (/tmp/build_c2f299eb/node_modules/gensync/index.js:269:25) at evaluateAsync (/tmp/build_c2f299eb/node_modules/gensync/index.js:291:5) at /tmp/build_c2f299eb/node_modules/gensync/index.js:44:11 at Array.forEach (<anonymous>) at Function.async (/tmp/build_c2f299eb/node_modules/gensync/index.js:43:15) at Function.all (/tmp/build_c2f299eb/node_modules/gensync/index.js:216:13) at Generator.next (<anonymous>) at loadOneConfig (/tmp/build_c2f299eb/node_modules/@babel/core/lib/config/files/configuration.js:108:34) at loadOneConfig.next (<anonymous>) at buildRootChain (/tmp/build_c2f299eb/node_modules/@babel/core/lib/config/config-chain.js:68:51) at buildRootChain.next (<anonymous>) at loadPrivatePartialConfig (/tmp/build_c2f299eb/node_modules/@babel/core/lib/config/partial.js:85:62) at loadPrivatePartialConfig.next (<anonymous>) at /tmp/build_c2f299eb/node_modules/@babel/core/lib/config/partial.js:131:25 at Generator.next (<anonymous>) at step (/tmp/build_c2f299eb/node_modules/gensync/index.js:269:25) at evaluateAsync (/tmp/build_c2f299eb/node_modules/gensync/index.js:291:5) ! ! Precompiling assets failed. ! ! Push rejected, failed to compile Ruby app. ! Push failed
試したこと
エラー文を読むと原因は
【エラー: /tmp/build_c2f299eb/babel.config.js: 構成はエクスポートされた JavaScript オブジェクトである必要があります。】
とのことでしたのでエクスポートされていないことが原因だと思いました。
javasprict
1 2import '@fortawesome/fontawesome-free/js/all'; 3// This file is automatically compiled by Webpack, along with any other files 4// present in this directory. You're encouraged to place your actual application logic in 5// a relevant structure within app/javascript and only use these pack files to reference 6// that code so it'll be compiled. 7 8require("@rails/ujs").start() 9// require("turbolinks").start() 10require("channels") 11 12// Uncomment to copy all static images under ../images to the output folder and reference 13// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>) 14// or the `imagePath` JavaScript helper below. 15// 16// const images = require.context('../images', true) 17// const imagePath = (name) => images(name, true) 18 19
(/app/javascript/packs/application.js)
ジャバスプリクト(/app/javascript/packs/application.js)の中身はこんな感じで特に問題ないと思います
Javaスプリクトの機能をつけようとしてうまくいかなかったものが残っていたので名前を削除して上記の記述になっています。
(かなり右往左往で弄っていて何かを消していたらすみません)
補足情報(FW/ツールのバージョンなど)
webpacker', '> 4.0'> 6.0.0'
ruby '2.6.5'
'rails', '
Ruby on railsでアプリを作成しています。
原因がなんとなくしかわからず、わかりにくい質問になっていると感じていますが
もし何かお分かりになる方がいらっしゃいましたらご教授いただけると助かります。
よろしくお願いいたします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。