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

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

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

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

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

Q&A

解決済

2回答

1927閲覧

herokuデプロイで、NoMethodError: undefined method `new' for :uglifier:Symbolというエラー

tomato185

総合スコア29

Ruby on Rails 5

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

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

0グッド

0クリップ

投稿2020/09/25 06:24

編集2020/09/25 09:53

###問題・エラー

ローカル環境で完成したものをherokuにプッシュしようとしました。
ですが、下記のようにデプロイ中にエラーが発生しました。

:uglifier:Symbolというのはどうゆうものなのでしょうか。
エラーの原因はこちらなのでしょうか。。。

(略) Bundle complete! 30 Gemfile dependencies, 130 gems now installed. remote: Gems in the groups development and test were not installed. remote: Bundled gems are installed into `./vendor/bundle` remote: Post-install message from autoprefixer-rails: remote: autoprefixer-rails was deprected. Migration guide: remote: https://github.com/ai/autoprefixer-rails/wiki/Deprecated remote: Post-install message from fog: remote: ------------------------------ remote: Thank you for installing fog! remote: remote: IMPORTANT NOTICE: remote: If there's a metagem available for your cloud provider, e.g. `fog-aws`, remote: you should be using it instead of requiring the full fog collection to avoid remote: unnecessary dependencies. remote: remote: 'fog' should be required explicitly only if: remote: - The provider you use doesn't yet have a metagem available. remote: - You require Ruby 1.9.3 support. remote: ------------------------------ remote: Bundle completed (18.24s) remote: Cleaning up the bundler cache. remote: 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`. remote: -----> Installing node-v12.16.2-linux-x64 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: rake aborted! remote: NoMethodError: undefined method `new' for :uglifier:Symbol remote: /tmp/build_f6256d5c/config/environments/production.rb:26:in `block in <main>' remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/railtie.rb:216:in `instance_eval' remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/railtie.rb:216:in `configure' remote: /tmp/build_f6256d5c/config/environments/production.rb:1:in `<main>' remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require' remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi' remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register' remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/bootsnap-1.4.8/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi' (略) remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/activesupport-5.2.4.3/lib/active_support/dependencies.rb:291:in `require' remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/application.rb:337:in `require_environment!' remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/railties-5.2.4.3/lib/rails/application.rb:520:in `block in run_tasks_blocks' remote: /tmp/build_f6256d5c/vendor/bundle/ruby/2.6.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define' remote: Tasks: TOP => environment remote: (See full trace by running task with --trace) 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 totologstore. remote: To https://git.heroku.com/totologstore.git ! [remote rejected] master -> master (pre-receive hook declined)
config/environments/production.rb config.assets.js_compressor = :uglifier.new(harmony: true)

###追加エラー

Installing node-v12.16.2-linux-x64 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: Yarn executable was not detected in the system. remote: Download Yarn at https://yarnpkg.com/en/docs/install remote: I, [2020-09-25T09:50:01.782784 #524] INFO -- : Writing /tmp/build_aef7b381/public/assets/application-0e6021ace7b6e1b679b5d7586cb8d657bda03b6e0513de162e01362f406fea55.js remote: I, [2020-09-25T09:50:01.783242 #524] INFO -- : Writing /tmp/build_aef7b381/public/assets/application-0e6021ace7b6e1b679b5d7586cb8d657bda03b6e0513de162e01362f406fea55.js.gz remote: rake aborted! remote: NoMethodError: undefined method `[]' for nil:NilClass remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:278:in `sprockets_context' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:124:in `asset_path' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sprockets-3.7.2/lib/sprockets/sass_processor.rb:200:in `font_path' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/tree/funcall.rb:151:in `block in _perform' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:108:in `block in with_function' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:135:in `with_frame' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:108:in `with_function' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/tree/funcall.rb:149:in `_perform' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/script/tree/node.rb:50:in `perform' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:412:in `visit_return' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/base.rb:36:in `visit' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/tree/visitors/perform.rb:158:in `block in visit' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:79:in `block in with_base' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:135:in `with_frame' remote: /tmp/build_aef7b381/vendor/bundle/ruby/2.6.0/gems/sass-3.7.4/lib/sass/stack.rb:79:in `with_base'

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

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

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

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

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

guest

回答2

0

Yikes! not really familiar with this hehe, what code did you use?

投稿2020/09/28 05:12

EmmaBabe

総合スコア32

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

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

0

ベストアンサー

〜質問内容が大幅に変わったので、追記します〜

解決方法としては、下記のどちらかになるかと思います。

  • config.assets.js_compressor = :uglifier.new(harmony: true)を削除する
  • uglifierのgemを入れる

それとも別の場所でエラーが出ているのでしょうか。

rake aborted!のところで、rakeコマンドが中止されています。
その前後を見ると、NoMethodError: undefined method '[]' for nil:NilClassというエラーが、
Writing /tmp/build_a902e2a2/public/assets/application-....js.gz付近で出たということが読み取れます。

ruby

1remote: I, [2020-09-25T06:05:30.313278 519] INFO -- : Writing /tmp/build_a902e2a2/public/assets/application-....js.gz 2remote: rake aborted! # <= rakeコマンドが中止された。 3remote: NoMethodError: undefined method `[]' for nil:NilClass 4

アセットパイプライン付近のところでエラーが起きているので、config.assets.compile = trueの設定を確認いただくと解決に近づくかもしれません。

参考:https://qiita.com/kazukimatsumoto/items/a0daa7281a3948701c39#configenvironmentsproductionrb%E3%81%AE%E8%A8%AD%E5%AE%9A

投稿2020/09/25 06:57

編集2020/09/25 07:05
no1knows

総合スコア3365

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

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

tomato185

2020/09/25 08:29

no1knowsさん、 勝手に質問内容を変えてしまい、申し訳ありませんでした。 また早急のご対応もありがとうございます。 *config.assets.js_compressor = :uglifier.new(harmony: true)の削除 *config.assets.compile = false にしてみましたが、 NoMethodError: undefined method `[]' for nil:NilClassという同様のエラーがでてしまいました。
no1knows

2020/09/25 08:42

config.assets.js_compressor = :uglifier.new(harmony: true)の削除して config.assets.compile = trueにしてみてください。
tomato185

2020/09/25 09:54

追加エラーに記載した通り、 同様のエラーでした。
tomato185

2020/09/25 10:23

no1knows様 全てのstylesheetをscssに直したら、無事にデプロイできました。
no1knows

2020/09/26 03:25

デプロイおめでとうございます! cssだとデプロイできないということですか・・・初めて知りました。 勉強になりました。ありがとうございます!
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.46%

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

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

質問する

関連した質問