My ruby version is 2.3.0, my mysql version is 8.0.23, my mysql2 version is 0.5.3, my rails version is 5.0.7.2, and my Xcode version is 12.5.
I use macOS Big Sur(version 11.4) and the text editor "Atom".
I'm planning to release my Rails application with the URL of HEROKU(example. https://[My APP Name].herokuapp.com).
I ran the following command.
$ heroku open
The following error occured.
An unhandled lowlevel error occurred. The application logs may have details.
I ran the following command.
$ heroku logs
#<RuntimeError: Missing
`secret_key_base` for 'production' environment, set this value in `
config/secrets.yml`>
My config/secrets.yml file is something like belows.
production:
secret_key_base: <%= ENV["SECRET_KEY_BASE"] %>
I edited my config/secrets.yml file as below.
production:
secret_key_base: <%= ENV["secret_key_base"] %>
I deleted two environment variables as below with this command: $ heroku config:unset [ENVIRONMENT VARIABLE NAME]
.
$ heroku config:unset DATABASE_USERNAME=****
$ heroku config:unset DATABASE_PASSWORD=GENERATED_CODE
I deleted the environment variable SECRET_KEY_BASE
in the vim editor of /etc/profile
, using the following command.
$ vi /etc/profile
I saved the vim editor of /etc/profile
to end it with the two below commands.
:w !sudo tee %
:q!
I deleted the environment variable SECRET_KEY_BASE
, using the following command.
$ vi ~/.bash_profile
I saved .bash_profile
,using Esc and then ":x
" and Enter.
I ran the following command.
$ bundle exec rake secret
bash: /usr/local/bin/bundle: /System/Library/Frameworks/Ruby.framework/Versions/2.3/
usr/bin/ruby: bad interpreter: No such file or directory
I ran the following command.
$ sed -i 's/\r//' usr/local/bin/bundle
sed: 1: "usr/local/bin/bundle": invalid command code u
I ran the following command.
$ /usr/local/bin/bundle
bash: /usr/local/bin/bundle: /System/Library/Frameworks/Ruby.framework/Versions/2.3/
usr/bin/ruby: bad interpreter: No such file or directory
Below are the output of gem env
, which bundle
and which ruby
.
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [universal.x86_64-darwin20]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/****/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/
ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/****/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-20
- GEM PATHS:
- /Library/Ruby/Gems/2.6.0
- /Users/****/.gem/ruby/2.6.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.
0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Users/****/.rbenv/shims
$ which bundle
/usr/local/bin/bundle
$ which ruby
/usr/bin/ruby
I installed the ruby version "2.3.0" as below ,because bundle seems to call "2.3".
$ rbenv install 2.3.0
Downloading openssl-1.0.2u.tar.gz...
-> https://****
Installing openssl-1.0.2u...
Installed openssl-1.0.2u to /Users/****/.rbenv/versions/2.3.0
Downloading ruby-2.3.0.tar.bz2...
-> https://****
Installing ruby-2.3.0...
WARNING: ruby-2.3.0 is past its end of life and is now unsupported.
It no longer receives bug fixes or critical security updates.
ruby-build: using readline from homebrew
Installed ruby-2.3.0 to /Users/****/.rbenv/versions/2.3.0
I verified that the ruby version "2.3.0" is installed and the current ruby version is "2.3.0".
$ rbenv local 2.3.0
$ rbenv rehash
$ rbenv versions
system
* 2.3.0
$ rbenv global 2.3.0
$ rbenv rehash
$ rbenv versions
system
* 2.3.0
But the ruby current version is "2.6.3" when used the below command.
$ ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [universal.x86_64-darwin20]
$ gem env
RubyGems Environment:
- RUBYGEMS VERSION: 3.0.3
- RUBY VERSION: 2.6.3 (2019-04-16 patchlevel 62) [universal.x86_64-darwin20]
- INSTALLATION DIRECTORY: /Library/Ruby/Gems/2.6.0
- USER INSTALLATION DIRECTORY: /Users/****/.gem/ruby/2.6.0
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
- GIT EXECUTABLE: /usr/local/bin/git
- EXECUTABLE DIRECTORY: /usr/local/bin
- SPEC CACHE DIRECTORY: /Users/****/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Library/Ruby/Site
- RUBYGEMS PLATFORMS:
- ruby
- universal-darwin-20
- GEM PATHS:
- /Library/Ruby/Gems/2.6.0
- /Users/****/.gem/ruby/2.6.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /bin
- /usr/sbin
- /sbin
- /Users/****/.rbenv/shims
I ran the following command.
$ bundle exec rake secret
bash: /usr/local/bin/bundle: /System/Library/Frameworks/Ruby.framework/Versions/2.3/
usr/bin/ruby: bad interpreter: No such file or directory
Why can't I execute $ bundle exec rake secret
? And why are there the multiple current ruby versions "2.3.0","2.6.3"?
The error "bad interpreter: No such file or directory
" occured.