[RUBY] Rails tutorial memorandum 2

environment

macOS Catalina 10.15.5 Rails 6.0.3

I'll write a Rails tutorial and a lot of it. The tutorial is compliant with the 6th edition because I want to get used to Github.

1.5.1 Setting up and deploying Heroku

List 1.21

$ heroku create

 ›   Warning: heroku update available from 7.42.13 to 7.43.0.
Creating app... done, ⬢ *****
https://*****.herokuapp.com/ | https://git.heroku.com/*****.git

$ git push heroku master

remote:        LoadError: cannot load such file -- uglifier
error: failed to push some refs to 'https://git.heroku.com/*****.git'

Refer to the following, https://algorithm.joho.info/heroku/error-failed-to-push-some-refs-to/ $ git fetch $ git rebase heroku/master I ran, but it didn't work as shown below.

fatal: invalid upstream 'heroku/master'

Also, refer to the following https://ja.stackoverflow.com/questions/67934/git-push-heroku-master%E3%81%A7%E7%99%BA%E7%94%9F%E3%81%99%E3%82%8B%E3%82%A8%E3%83%A9%E3%83%BC-precompiling-assets-failed-error-failed-to-pu Try adding the ʻuglifier` gem to the Gemfile.

Gemfile


gem 'bootsnap',   '1.4.5', require: false
gem 'uglifier'

Execute the following again $ git commit -a -m "Update Gemfile for Heroku" $ git push heroku master

remote: LoadError: cannot load such file --uglifier disappeared ʻError: failed to push some refs to ~` remains unchanged.

The error when executing $ git push heroku master was as follows.

remote: ###### WARNING:
remote: 
remote:        This buildpack was created as a stop-gap measure to allow running applications with Bundler 2 on Heroku.
remote:        Heroku now supports Bundler 2 directly: https://devcenter.heroku.com/changelog-items/1563
remote:        
remote:        Please discontinue use of this buildpack and instead directly use the `heroku/ruby` buildpack.
remote:        
remote:        To remove this buildpack use the `heroku buildpacks` command to list your existing buildpacks.
remote:        
remote:        If you only have one buildpack listed you can run:
remote:        
remote:        ```
remote:        heroku buildpacks:set heroku/ruby
remote:        ```
remote:        
remote:        If you have multiple buildpacks, you'll need to add the buildpack to the correct location using
remote:        `heroku buildpacks:add heroku/ruby -i <correct index>` and then remove this buildpack via:
remote:        
remote:        ```
remote:        heroku buildpacks:remove https://github.com/bundler/heroku-buildpack-bundler2
remote:        ```

Only the following Buildpacks are available on $ heroku buildpacks.

https://github.com/bundler/heroku-buildpack-bundler2

So run $ heroku buildpacks: set heroku / ruby.

Buildpack set. Next release on pacific-atoll-18588 will use heroku/ruby.
Run git push heroku main to create a new release using this buildpack.

When you $ git push heroku master again, this time the following warning.

remote:        webpack binstubs not found.
remote:        Have you run rails webpacker:install ?
remote:        Make sure the bin directory or binstubs are not included in .gitignore
remote:        Exiting!

https://archive.blog.inomar.me/2018/08/19/rails5-1%E3%81%A7webpack%E3%81%8C%E4%BD%BF%E7%94%A8%E3%81%A7%E3%81%8D%E3%82%8B%E3%81%AE%E3%81%A7vuejs%E3%81%A7%E9%81%8A%E3%82%93%E3%81%A7%E3%81%BF%E3%81%9F/ Execute $ bundle exec rails webpacker: install referring to the above. Even if I $ git push heroku master again, the above warning does not disappear.

remote:        webpack binstubs not found.
remote:        Have you run rails webpacker:install ?
remote:        Make sure the bin directory or binstubs are not included in .gitignore
remote:        Exiting!

Run $ git push heroku main.

error: src refspec main does not match any
error: failed to push some refs to 'https://git.heroku.com/*****.git'

I tried to force push with $ git push heroku main -f, but the result was the same. I deleted and recreated the git repository, recreated the heroku app, and added, commit, and pushed, but The following error does not disappear ...

 ![remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/*****.git'

When I ran $ git push heroku main -f again with no use, it was finally completed. I think I've done a lot of meaningless downloads, so I'm worried that it will work safely after this ...

Recommended Posts

Rails tutorial memorandum 1
Rails tutorial memorandum 2
Rails Tutorial Memorandum (Chapter 3, 3.1)
Rails Tutorial Memorandum (Chapter 3, 3.3.2)
rails tutorial
rails tutorial
rails tutorial
rails tutorial
rails tutorial
rails tutorial
rails tutorial
Rails Tutorial Records and Memorandum # 0
rails tutorial Chapter 6
Rails tutorial test
rails tutorial Chapter 1
rails tutorial Chapter 7
rails tutorial Chapter 5
rails tutorial Chapter 10
rails tutorial Chapter 9
rails tutorial Chapter 8
Start Rails Tutorial
[Beginner] Rails Tutorial
Rails Tutorial Chapter 10 Notes
Rails Tutorial Chapter 3 Notes
Rails Tutorial cheat sheet
Rails Tutorial Chapter 3 Learning
Rails version upgrade memorandum 5.0 → 5.1
[Rails] Learning with Rails tutorial
Rails Tutorial Chapter 4 Notes
Rails Tutorial Chapter 4 Learning
Rails Tutorial Chapter 1 Learning
Rails Tutorial Chapter 2 Learning
Rails Tutorial Chapter 8 Notes
rails tutorial fighting notes Ⅲ
Cloud9 is out of memory: Rails tutorial memorandum
[Rails tutorial] A memorandum of "Chapter 11 Account Activation"
memorandum
Rails Tutorial (4th Edition) Summary
[Rails Tutorial Chapter 4] Rails-flavored Ruby
[Rails] Rails version upgrade error memorandum
[Rails] Implementation of tutorial function
memorandum
Ruby on Rails Basic Memorandum
Memorandum [Rails] User authentication Devise
[Rails Struggle/Rails Tutorial] Summary of Rails Tutorial Chapter 2
Piped together grep ?: Rails Tutorial Notes--Chapter 8
[Rails Tutorial Chapter 5] Create a layout
rails tutorial chapter 10 summary (for self-learning)
Chewing Rails Tutorial [Chapter 2 Toy Application]
Rails Tutorial (4th Edition) Memo Chapter 6
[Rails g.error]
Rails Tutorial 6th Edition Learning Summary Chapter 10
Rails Tutorial 6th Edition Learning Summary Chapter 7
Rails basics
Rails Review 1
Rails Tutorial 6th Edition Learning Summary Chapter 4
[Rails] first_or_initialize
Rails Tutorial 6th Edition Learning Summary Chapter 9
Rails Tutorial 6th Edition Learning Summary Chapter 6
About Rails 6
Java memorandum