iT邦幫忙

2018 iT 邦幫忙鐵人賽
DAY 18
3

今天我們要發布網站到 Heroku,第一步就是要先註冊一個 Heroku 帳號:

註冊 Heroku 帳號

點開這個網址:https://signup.heroku.com/login

  • First name:名字
  • Last name:姓氏
  • Email Address:信箱
  • Role:職業
  • Primary Development Language:主要開發語言

除了信箱之外,其他的都沒有很重要,怕亂填會出問題的話就抄我的。填好之後就按 CREATE FREE ACCOUNT

他說:「請去收信,謝謝」,這個步驟是為了確認你真的有你所填的信箱。

這裡點一下信中的超連結:

這裡要輸入兩次密碼,密碼最少要 8 個字,輸入完之後按下 SET PASSWORD AND LOG IN

他說:「歡迎光臨」,這裡點一下 CLICK HERE TO PROCEED

這是平常登入會看到的畫面,他提供了各種教學,不過不用看他的,看我的就好。

我們平常不會透過這個後台去操作他,我們會使用 Heroku 提供的 Heroku CLI 來操作他。

安裝 Heroku CLI

點開這個網址:https://devcenter.heroku.com/articles/heroku-cli#windows

然後點 64-bit 下載安裝檔,下載後點開。

這邊直接點 Next

Next

安裝完成!點 Close

然後什麼事也沒發生。所以我們剛剛安裝了什麼?

試用 Heroku CLI

開啟一個小黑框,輸入 heroku

如果你沒有看到這個畫面,那表示你可能在安裝的過程中遭遇到一些問題。或許可以考慮下載 32-bit 的安裝檔重裝一次看看。

這裡是指令教學,跟卡米狗教學差不多,不過不用看他的,看我的就好。

輸入 heroku login 作登入:

他說:「請輸入信箱:」

他說:「請輸入密碼:」

他說:「登入成功。」

heroku 的初始設定到這裡就算完成了,接下來我們安裝 Git。

安裝 Git

點開這個網址:https://git-scm.com/download/win,沒意外的話點開就已經自動下載了。

要開始安裝了,安裝流程很長,注意看我選什麼,跟著選就對了。

這是填安裝路徑,沒事不要亂改。

跟 Heroku 一樣,這個安裝好之後要到小黑框才能用。

試用 Git

開啟一個小黑框,輸入 git

如果你沒有看到上面的畫面,那表示你可能在安裝的過程中遭遇到一些問題。遇到問題的話請截圖留言。 #在我的電腦上是好的

到這裡 git 就安裝完成了。

設定 git 作者資訊

git 是一套支援多人協作的軟體,因此他需要紀錄每次存檔的作者資訊。

設定作者名稱的方法是在小黑框裡輸入以下指令:

git config --global user.name "etrex kuo"

其中 etrex kuo 是我的名字,你應該把他改成你的名字。

設定信箱的方法是在小黑框裡輸入以下指令:

git config --global user.email "kamigo.service@gmail.com"

專案的 git 初始設定

我們會使用小黑框來上傳程式,先開一個在專案目錄下的小黑框,然後輸入 git init

你可能會看到:

D:\只要有心,人人都可以作卡米狗\ironman>git init
Initialized empty Git repository in D:/只要有心,人人都可以作卡米狗/ironman/.git/

或者看到:

D:\只要有心,人人都可以作卡米狗\ironman>git init
Reinitialized existing Git repository in D:/只要有心,人人都可以作卡米狗/ironman/.git/

看到這兩個其中一個都是正常現象,都沒關係,看到其他的就見鬼啦。

專案的 heroku 初始設定

我們要在 heroku 建立一台新的網頁伺服器,輸入的指令是 heroku create + 專案名稱,這個名稱要夠特殊,要不然會跟別人撞名。

我選的專案名稱是 people-all-love-kamigo,所以我輸入 heroku create people-all-love-kamigo

D:\只要有心,人人都可以作卡米狗\ironman>heroku create people-all-love-kamigo
Creating people-all-love-kamigo... done
https://people-all-love-kamigo.herokuapp.com/ | https://git.heroku.com/people-all-love-kamigo.git

D:\只要有心,人人都可以作卡米狗\ironman>

建立好之後回到 heroku 的後台(https://dashboard.heroku.com/apps)上你會看到一個 app:

在 heroku 上面網頁伺服器被稱為 app,這就是我們剛剛建立的網頁伺服器。

上傳程式碼到 Heroku

我們要使用 git 來上傳程式碼,而 git 是一款非常強大的版本控管軟體,擁有非常多的功能。但我們要上傳程式碼只需要學習其中的 3 個指令。

  • git add
  • git commit
  • git push

一個個來,首先是 git add,git add 可以指定這次想要加入控管的檔案,我們輸入 git add .,表示我們想把所有的檔案都加入控管。

D:\只要有心,人人都可以作卡米狗\ironman>git add .
warning: LF will be replaced by CRLF in .gitignore.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Gemfile.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Gemfile.lock.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in README.md.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in Rakefile.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/config/manifest.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/javascripts/application.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/javascripts/cable.js.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/assets/stylesheets/application.css.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/channels/application_cable/channel.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/channels/application_cable/connection.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/controllers/application_controller.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/helpers/application_helper.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/jobs/application_job.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/mailers/application_mailer.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/models/application_record.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/views/layouts/application.html.erb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/views/layouts/mailer.html.erb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in app/views/layouts/mailer.text.erb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in bin/bundle.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in bin/rails.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in bin/rake.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in bin/setup.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in bin/update.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in bin/yarn.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config.ru.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/application.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/boot.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/cable.yml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/database.yml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/environment.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/environments/development.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/environments/production.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/environments/test.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/application_controller_renderer.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/assets.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/backtrace_silencers.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/cookies_serializer.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/filter_parameter_logging.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/inflections.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/mime_types.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/initializers/wrap_parameters.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/locales/en.yml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/puma.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/routes.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in config/secrets.yml.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in db/seeds.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in package.json.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/404.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/422.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/500.html.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in public/robots.txt.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in test/application_system_test_case.rb.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in test/test_helper.rb.
The file will have its original line endings in your working directory.

D:\只要有心,人人都可以作卡米狗\ironman>

一堆訊息但不是很重要,他說:「我把 windows 的換行符號改成別種系統的換行符號了哦。」

接下來是 git commit, git commit 表示我們想要建立一個新的版本,我們要留下一些紀錄說明這個版本作了什麼變更,因為是第一次,所以我們輸入 git commit -m init

D:\只要有心,人人都可以作卡米狗\ironman>git commit -m init
[master (root-commit) 8c48959] init
 76 files changed, 1203 insertions(+)
 create mode 100644 .gitignore
 create mode 100644 Gemfile
 create mode 100644 Gemfile.lock
 create mode 100644 README.md
 create mode 100644 Rakefile
 create mode 100644 app/assets/config/manifest.js
 create mode 100644 app/assets/images/.keep
 create mode 100644 app/assets/javascripts/application.js
 create mode 100644 app/assets/javascripts/cable.js
 create mode 100644 app/assets/javascripts/channels/.keep
 create mode 100644 app/assets/stylesheets/application.css
 create mode 100644 app/channels/application_cable/channel.rb
 create mode 100644 app/channels/application_cable/connection.rb
 create mode 100644 app/controllers/application_controller.rb
 create mode 100644 app/controllers/concerns/.keep
 create mode 100644 app/controllers/kamigo_controller.rb
 create mode 100644 app/helpers/application_helper.rb
 create mode 100644 app/jobs/application_job.rb
 create mode 100644 app/mailers/application_mailer.rb
 create mode 100644 app/models/application_record.rb
 create mode 100644 app/models/concerns/.keep
 create mode 100644 app/views/kamigo/eat.html
 create mode 100644 app/views/layouts/application.html.erb
 create mode 100644 app/views/layouts/mailer.html.erb
 create mode 100644 app/views/layouts/mailer.text.erb
 create mode 100644 bin/bundle
 create mode 100644 bin/rails
 create mode 100644 bin/rake
 create mode 100644 bin/setup
 create mode 100644 bin/update
 create mode 100644 bin/yarn
 create mode 100644 config.ru
 create mode 100644 config/application.rb
 create mode 100644 config/boot.rb
 create mode 100644 config/cable.yml
 create mode 100644 config/database.yml
 create mode 100644 config/environment.rb
 create mode 100644 config/environments/development.rb
 create mode 100644 config/environments/production.rb
 create mode 100644 config/environments/test.rb
 create mode 100644 config/initializers/application_controller_renderer.rb
 create mode 100644 config/initializers/assets.rb
 create mode 100644 config/initializers/backtrace_silencers.rb
 create mode 100644 config/initializers/cookies_serializer.rb
 create mode 100644 config/initializers/filter_parameter_logging.rb
 create mode 100644 config/initializers/inflections.rb
 create mode 100644 config/initializers/mime_types.rb
 create mode 100644 config/initializers/wrap_parameters.rb
 create mode 100644 config/locales/en.yml
 create mode 100644 config/puma.rb
 create mode 100644 config/routes.rb
 create mode 100644 config/secrets.yml
 create mode 100644 db/seeds.rb
 create mode 100644 lib/assets/.keep
 create mode 100644 lib/tasks/.keep
 create mode 100644 log/.keep
 create mode 100644 package.json
 create mode 100644 public/404.html
 create mode 100644 public/422.html
 create mode 100644 public/500.html
 create mode 100644 public/apple-touch-icon-precomposed.png
 create mode 100644 public/apple-touch-icon.png
 create mode 100644 public/favicon.ico
 create mode 100644 public/robots.txt
 create mode 100644 test/application_system_test_case.rb
 create mode 100644 test/controllers/.keep
 create mode 100644 test/fixtures/.keep
 create mode 100644 test/fixtures/files/.keep
 create mode 100644 test/helpers/.keep
 create mode 100644 test/integration/.keep
 create mode 100644 test/mailers/.keep
 create mode 100644 test/models/.keep
 create mode 100644 test/system/.keep
 create mode 100644 test/test_helper.rb
 create mode 100644 tmp/.keep
 create mode 100644 vendor/.keep

D:\只要有心,人人都可以作卡米狗\ironman>

一樣一堆訊息,他說:「這次建立的版本新增了這些檔案哦。」

「好哦~好哦~」

接下來是 git push,git push 可以把我們建立好的版本,傳送到遠端的 git server,當然我們是要傳送到 heroku,所以我們輸入的是 git push heroku master

D:\只要有心,人人都可以作卡米狗\ironman>git push heroku master
Counting objects: 85, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (70/70), done.
Writing objects: 100% (85/85), 20.55 KiB | 1.28 MiB/s, done.
Total 85 (delta 2), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote:  !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
remote:                         Detected buildpacks: Ruby,Node.js
remote:                         See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.3.4
remote: ###### WARNING:
remote:        Removing `Gemfile.lock` because it was generated on Windows.
remote:        Bundler will do a full resolve so native gems are handled properly.
remote:        This may result in unexpected gem versions being used in your app.
remote:        In rare occasions Bundler may not be able to resolve your dependencies at all.
remote:        https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: -----> Installing dependencies using bundler 1.15.2
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
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:        Fetching gem metadata from https://rubygems.org/..........
remote:        Fetching version metadata from https://rubygems.org/..
remote:        Fetching dependency metadata from https://rubygems.org/.
remote:        Resolving dependencies...
remote:        Fetching rake 12.3.0
remote:        Fetching concurrent-ruby 1.0.5
remote:        Fetching minitest 5.11.1
remote:        Installing minitest 5.11.1
remote:        Installing rake 12.3.0
remote:        Installing concurrent-ruby 1.0.5
remote:        Fetching thread_safe 0.3.6
remote:        Installing thread_safe 0.3.6
remote:        Fetching builder 3.2.3
remote:        Installing builder 3.2.3
remote:        Fetching erubi 1.7.0
remote:        Fetching mini_portile2 2.3.0
remote:        Installing erubi 1.7.0
remote:        Fetching crass 1.0.3
remote:        Installing mini_portile2 2.3.0
remote:        Fetching rack 2.0.3
remote:        Installing crass 1.0.3
remote:        Fetching nio4r 2.2.0
remote:        Installing rack 2.0.3
remote:        Installing nio4r 2.2.0 with native extensions
remote:        Fetching websocket-extensions 0.1.3
remote:        Installing websocket-extensions 0.1.3
remote:        Fetching mini_mime 1.0.0
remote:        Installing mini_mime 1.0.0
remote:        Fetching arel 8.0.0
remote:        Installing arel 8.0.0
remote:        Using bundler 1.15.2
remote:        Fetching coffee-script-source 1.12.2
remote:        Fetching execjs 2.7.0
remote:        Installing execjs 2.7.0
remote:        Installing coffee-script-source 1.12.2
remote:        Fetching method_source 0.9.0
remote:        Fetching thor 0.20.0
remote:        Installing method_source 0.9.0
remote:        Installing thor 0.20.0
remote:        Fetching ffi 1.9.18
remote:        Fetching multi_json 1.12.2
remote:        Installing multi_json 1.12.2
remote:        Fetching puma 3.11.0
remote:        Installing puma 3.11.0 with native extensions
remote:        Installing ffi 1.9.18 with native extensions
remote:        Fetching rb-fsevent 0.10.2
remote:        Installing rb-fsevent 0.10.2
remote:        Fetching tilt 2.0.8
remote:        Installing tilt 2.0.8
remote:        Fetching sqlite3 1.3.13
remote:        Installing sqlite3 1.3.13 with native extensions
remote:        Fetching turbolinks-source 5.0.3
remote:        Installing turbolinks-source 5.0.3
remote:        Fetching i18n 0.9.1
remote:        Installing i18n 0.9.1
remote:        Fetching tzinfo 1.2.4
remote:        Installing tzinfo 1.2.4
remote:        Fetching nokogiri 1.8.1
remote:        Installing nokogiri 1.8.1 with native extensions
remote:        Fetching websocket-driver 0.6.5
remote:        Installing websocket-driver 0.6.5 with native extensions
remote:        Fetching mail 2.7.0
remote:        Installing mail 2.7.0
remote:        Fetching rack-test 0.8.2
remote:        Installing rack-test 0.8.2
remote:        Fetching sprockets 3.7.1
remote:        Installing sprockets 3.7.1
remote:        Fetching uglifier 4.1.2
remote:        Installing uglifier 4.1.2
remote:        Fetching coffee-script 2.4.1
remote:        Installing coffee-script 2.4.1
remote:        Fetching turbolinks 5.0.1
remote:        Installing turbolinks 5.0.1
remote:        Fetching activesupport 5.1.4
remote:        Installing activesupport 5.1.4
remote:        Fetching rb-inotify 0.9.10
remote:        Installing rb-inotify 0.9.10
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:        current directory:
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/ruby-2.3.4/bin/ruby -r
remote:        ./siteconf20180106-281-1k06dok.rb extconf.rb
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'brew install sqlite3',
remote:        'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
remote:        and check your shared library search path (the
remote:        location where your sqlite3 shared library is located).
remote:        *** extconf.rb failed ***
remote:        Could not create Makefile due to some reason, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
remote:        Provided configuration options:
remote:        --with-opt-dir
remote:        --without-opt-dir
remote:        --with-opt-include
remote:        --without-opt-include=${opt-dir}/include
remote:        --with-opt-lib
remote:        --without-opt-lib=${opt-dir}/lib
remote:        --with-make-prog
remote:        --without-make-prog
remote:        --srcdir=.
remote:        --curdir
remote:        --ruby=/tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
remote:        --with-sqlite3-config
remote:        --without-sqlite3-config
remote:        --with-pkg-config
remote:        --without-pkg-config
remote:        --with-sqlite3-dir
remote:        --without-sqlite3-dir
remote:        --with-sqlite3-include
remote:        --without-sqlite3-include=${sqlite3-dir}/include
remote:        --with-sqlite3-lib
remote:        --without-sqlite3-lib=${sqlite3-dir}/lib
remote:        To see why this extension failed to compile, please check the mkmf.log which can
remote:        be found here:
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.log
remote:        extconf failed, exit code 1
remote:        Gem files will remain installed in
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
remote:        An error occurred while installing sqlite3 (1.3.13), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.
remote:        In Gemfile:
remote:        sqlite3
remote:        Bundler Output: 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:        Fetching gem metadata from https://rubygems.org/..........
remote:        Fetching version metadata from https://rubygems.org/..
remote:        Fetching dependency metadata from https://rubygems.org/.
remote:        Resolving dependencies...
remote:        Fetching rake 12.3.0
remote:        Fetching concurrent-ruby 1.0.5
remote:        Fetching minitest 5.11.1
remote:        Installing minitest 5.11.1
remote:        Installing rake 12.3.0
remote:        Installing concurrent-ruby 1.0.5
remote:        Fetching thread_safe 0.3.6
remote:        Installing thread_safe 0.3.6
remote:        Fetching builder 3.2.3
remote:        Installing builder 3.2.3
remote:        Fetching erubi 1.7.0
remote:        Fetching mini_portile2 2.3.0
remote:        Installing erubi 1.7.0
remote:        Fetching crass 1.0.3
remote:        Installing mini_portile2 2.3.0
remote:        Fetching rack 2.0.3
remote:        Installing crass 1.0.3
remote:        Fetching nio4r 2.2.0
remote:        Installing rack 2.0.3
remote:        Installing nio4r 2.2.0 with native extensions
remote:        Fetching websocket-extensions 0.1.3
remote:        Installing websocket-extensions 0.1.3
remote:        Fetching mini_mime 1.0.0
remote:        Installing mini_mime 1.0.0
remote:        Fetching arel 8.0.0
remote:        Installing arel 8.0.0
remote:        Using bundler 1.15.2
remote:        Fetching coffee-script-source 1.12.2
remote:        Fetching execjs 2.7.0
remote:        Installing execjs 2.7.0
remote:        Installing coffee-script-source 1.12.2
remote:        Fetching method_source 0.9.0
remote:        Fetching thor 0.20.0
remote:        Installing method_source 0.9.0
remote:        Installing thor 0.20.0
remote:        Fetching ffi 1.9.18
remote:        Fetching multi_json 1.12.2
remote:        Installing multi_json 1.12.2
remote:        Fetching puma 3.11.0
remote:        Installing puma 3.11.0 with native extensions
remote:        Installing ffi 1.9.18 with native extensions
remote:        Fetching rb-fsevent 0.10.2
remote:        Installing rb-fsevent 0.10.2
remote:        Fetching tilt 2.0.8
remote:        Installing tilt 2.0.8
remote:        Fetching sqlite3 1.3.13
remote:        Installing sqlite3 1.3.13 with native extensions
remote:        Fetching turbolinks-source 5.0.3
remote:        Installing turbolinks-source 5.0.3
remote:        Fetching i18n 0.9.1
remote:        Installing i18n 0.9.1
remote:        Fetching tzinfo 1.2.4
remote:        Installing tzinfo 1.2.4
remote:        Fetching nokogiri 1.8.1
remote:        Installing nokogiri 1.8.1 with native extensions
remote:        Fetching websocket-driver 0.6.5
remote:        Installing websocket-driver 0.6.5 with native extensions
remote:        Fetching mail 2.7.0
remote:        Installing mail 2.7.0
remote:        Fetching rack-test 0.8.2
remote:        Installing rack-test 0.8.2
remote:        Fetching sprockets 3.7.1
remote:        Installing sprockets 3.7.1
remote:        Fetching uglifier 4.1.2
remote:        Installing uglifier 4.1.2
remote:        Fetching coffee-script 2.4.1
remote:        Installing coffee-script 2.4.1
remote:        Fetching turbolinks 5.0.1
remote:        Installing turbolinks 5.0.1
remote:        Fetching activesupport 5.1.4
remote:        Installing activesupport 5.1.4
remote:        Fetching rb-inotify 0.9.10
remote:        Installing rb-inotify 0.9.10
remote:        Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
remote:
remote:        current directory:
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13/ext/sqlite3
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/ruby-2.3.4/bin/ruby -r
remote:        ./siteconf20180106-281-1k06dok.rb extconf.rb
remote:        checking for sqlite3.h... no
remote:        sqlite3.h is missing. Try 'brew install sqlite3',
remote:        'yum install sqlite-devel' or 'apt-get install libsqlite3-dev'
remote:        and check your shared library search path (the
remote:        location where your sqlite3 shared library is located).
remote:        *** extconf.rb failed ***
remote:        Could not create Makefile due to some reason, probably lack of necessary
remote:        libraries and/or headers.  Check the mkmf.log file for more details.  You may
remote:        need configuration options.
remote:
remote:        Provided configuration options:
remote:        --with-opt-dir
remote:        --without-opt-dir
remote:        --with-opt-include
remote:        --without-opt-include=${opt-dir}/include
remote:        --with-opt-lib
remote:        --without-opt-lib=${opt-dir}/lib
remote:        --with-make-prog
remote:        --without-make-prog
remote:        --srcdir=.
remote:        --curdir
remote:        --ruby=/tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/ruby-2.3.4/bin/$(RUBY_BASE_NAME)
remote:        --with-sqlite3-config
remote:        --without-sqlite3-config
remote:        --with-pkg-config
remote:        --without-pkg-config
remote:        --with-sqlite3-dir
remote:        --without-sqlite3-dir
remote:        --with-sqlite3-include
remote:        --without-sqlite3-include=${sqlite3-dir}/include
remote:        --with-sqlite3-lib
remote:        --without-sqlite3-lib=${sqlite3-dir}/lib
remote:
remote:        To see why this extension failed to compile, please check the mkmf.log which can
remote:        be found here:
remote:
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/mkmf.log
remote:
remote:        extconf failed, exit code 1
remote:
remote:        Gem files will remain installed in
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/bundle/ruby/2.3.0/gems/sqlite3-1.3.13
remote:        for inspection.
remote:        Results logged to
remote:        /tmp/build_64f38be744eeec1bbcc825497e62d9fc/vendor/bundle/ruby/2.3.0/extensions/x86_64-linux/2.3.0/sqlite3-1.3.13/gem_make.out
remote:
remote:        An error occurred while installing sqlite3 (1.3.13), and Bundler cannot
remote:        continue.
remote:        Make sure that `gem install sqlite3 -v '1.3.13'` succeeds before bundling.
remote:
remote:        In Gemfile:
remote:        sqlite3
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     Detected sqlite3 gem which is not supported on Heroku:
remote:  !     https://devcenter.heroku.com/articles/sqlite3
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to people-all-love-kamigo.
remote:
To https://git.heroku.com/people-all-love-kamigo.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/people-all-love-kamigo.git'

D:\只要有心,人人都可以作卡米狗\ironman>

一樣是一堆訊息,其實他這步驟作了非常多的事情,不過我們只要關注結果就好,結果就是 Push rejected, failed to compile Ruby app.,失敗惹。

失敗的原因寫在上面:

remote:        In Gemfile:
remote:        sqlite3
remote:  !
remote:  !     Failed to install gems via Bundler.
remote:  !     Detected sqlite3 gem which is not supported on Heroku:
remote:  !     https://devcenter.heroku.com/articles/sqlite3

heroku:「ㄉㄅㄑ,我不會用 sqlite3。」

今天就先到這裡,明天再講怎麼修。


上一篇
第十七天:怎麼讓別人連到我作好的網站?
下一篇
第十九天:發布網站到 Heroku (續)
系列文
只要有心,人人都可以做卡米狗33
2
jerryw47
iT邦新手 5 級 ‧ 2018-01-06 16:20:10

想請問一下,當打入 git add .時卻沒反應,想請問是什麼原因?
前面操作都正常
https://ithelp.ithome.com.tw/upload/images/20180106/20107956x7jv4x1guc.png

看更多先前的回應...收起先前的回應...

因為沒有發現新的檔案異動,所以沒有訊息。

喔不對 因為你的系統是 mac 而這個訊息是在說換行符號被改變,但你不需要改變換行符號,所以就沒訊息。

想請問下面這兩個要如何解決?因為無法出現像你的視窗顯示的那樣
https://ithelp.ithome.com.tw/upload/images/20180106/201079564W5clrExPp.png

喔喔 因為他要記錄每個版本的作者
需要輸入這兩個指令:

git config --global user.name "你的名字填這裡"
git config --global user.email "你的信箱填這裡"

我忘記講了QQ

這裡有更詳細的說明:https://gitbook.tw/chapters/config/user-config.html

感謝提醒,已修改本文

nienst iT邦新手 5 級‧ 2018-01-24 00:39:22 檢舉

卡卡米你好,我無法登入heroku,Heroku CLI我先安裝64-bit後來又裝32-bit,也是一樣。

C:\Users\Nien\Desktop\粘粘的卡米狗\ironman>heroku create nien-love-kamigo
Enter your Heroku credentials.
Email: ***@gmail.com
Password (typing will be hidden):
! Post https://api.heroku.com/login: http: error connecting to proxy https:/
/proxy.server.com:portnumber: dial tcp: lookup tcp/portnumber: getaddrinfow: The
specified class was not found.

C:\Users\Nien\Desktop\粘粘的卡米狗\ironman>

我有稍微爬文,有測試兩行指令
set HTTP_PROXY=http://proxy.server.com:portnumber
or

set HTTPS_PROXY=https://proxy.server.com:portnumber
heroku login

不知道是不是我漏了什麼?

那個 proxy 指令是在講說當你無法直接連到 heroku 時可以加,現在看起來你遇到的錯誤是因為你加了錯誤的網址 因為他上面的 http://proxy.server.com:portnumber 只是示意,你不應該直接用,因為那是個根本不存在的 proxy server,現在應該要去刪除他。

移除的方法應該是這樣:

set HTTP_PROXY=
set HTTPS_PROXY=
nienst iT邦新手 5 級‧ 2018-01-24 20:57:18 檢舉

感謝您,我剛剛測試後,出現一開始的訊息。
我當時就是點下面的連結,才嘗試昨天PO的指令。
後來發現portnumber好像是舉例,我也胡亂打了80或是其他數字,也都失敗。

C:\Users\Nien\Desktop\粘粘的卡米狗\ironman>set HTTP_PROXY=
C:\Users\Nien\Desktop\粘粘的卡米狗\ironman>set HTTPS_PROXY=
C:\Users\Nien\Desktop\粘粘的卡米狗\ironman>heroku create nien-love-kamigo
Enter your Heroku credentials.
Email: @gmail.com
Password (typing will be hidden):
! HTTP Error: https://api.heroku.com/login 400 Bad Request
! Invalid response from API.
! HTTP 400
! {@gmail.com ***}
!
! Are you behind a proxy?
! https://devcenter.heroku.com/articles/using-the-cli#using-an-http-proxy
C:\Users\Nien\Desktop\粘粘的卡米狗\ironman>

我剛剛改用https://api.heroku.com/login
在瀏覽器裡登入後
CMD打指令就成功了
雖然不知道為什麼
C:\Users\Nien\Desktop\粘粘的卡米狗\ironman>heroku create nien-love-kamigo
Creating nien-love-kamigo... !
! Invalid credentials provided.
Enter your Heroku credentials:
Email: ***@gmail.com
Password: ********
Creating nien-love-kamigo... done
https://nien-love-kamigo.herokuapp.com/ | https://git.heroku.com/nien-love-kamigo.git

有成功就好 我也不知道為什麼會不成功XD

0
nienst
iT邦新手 5 級 ‧ 2018-01-24 20:49:57

剛加入IT幫邦忙 不知道怎麼刪留言

0
wayneoh
iT邦新手 5 級 ‧ 2018-01-26 10:45:10

大大你好:
我再git push那邊出了點問題
他似乎說我沒有權限可以把檔案弄上去上面
但是我確實有登入
而且我也成功透過CLI去新增一個APP在後台上

如圖喔
https://ithelp.ithome.com.tw/upload/images/20180126/20108512MuO9mo45Cf.png

看更多先前的回應...收起先前的回應...
wayneoh iT邦新手 5 級‧ 2018-01-26 11:31:43 檢舉

大大剛剛問了GOOGLE大神
似乎是說~憑證不同 因為我以前就有裝過git跟heroku 但是都用一半就丟著沒用了~

找到這個:
It's common to get this error when using a cloned git repo onto a new machine. Even if your heroku credentials are already on the machine, there is no link between the cloned repo and heroku locally yet. To do this, cd into the root dir of the cloned repo and run

heroku git:remote -a yourapp

所以你已經解決問題了嗎?還是還沒?

wayneoh iT邦新手 5 級‧ 2018-01-26 13:13:44 檢舉

報告大大 解決了唷
解決的方法是:
heroku git:remote -a APP名稱
把憑證給洗掉重新弄

cool

0
q81086
iT邦新手 5 級 ‧ 2018-02-04 21:20:13

https://ithelp.ithome.com.tw/upload/images/20180204/20108020Z1nlM2KRQK.png

想請問這是什麼問題...
感恩米大

你們剛好安裝到一個 git 版本上有 bug,目前最新的 git 已經修正了這個問題,請移除 git 後重新安裝。

0
tilly0426
iT邦新手 5 級 ‧ 2018-02-07 14:35:06

請問一下><"

再打完git 指令輸入完名子和信箱後
https://ithelp.ithome.com.tw/upload/images/20180207/2010866874tv3hzz5y.png
git init 遇到一些問題
如果沒有理他..繼續做

https://ithelp.ithome.com.tw/upload/images/20180207/20108668bOROlHXNsr.png
git push heroku master那一行也會出問題 有警告訊息出現
我應該怎麼辦呢~~!?

感謝卡卡米大大!!

看更多先前的回應...收起先前的回應...

你們剛好安裝到一個 git 版本上有 bug,目前最新的 git 已經修正了這個問題,請移除 git 後重新安裝。

https://ithelp.ithome.com.tw/upload/images/20180207/201086686HXafRt0Od.png

重新安裝還是會發生一樣的情況耶Q_Q..
我是下載Git-2.16.1.3-64-bit.exe這個版本

試試看輸入 git version 看看目前版本是不是 2.16.1.3,如果是,但還是不行的話,試試看安裝這個版本:https://github.com/git-for-windows/git/releases/tag/v2.15.1.windows.2

我是2.16.1.3版本,剛剛下載連結..在git init指令還是出現一樣的錯誤訊息https://ithelp.ithome.com.tw/upload/images/20180207/20108668JvhWJoaq1L.png

so sad..

setmao iT邦新手 5 級‧ 2018-02-08 16:52:16 檢舉

看起來是字體的問題,可以用以下網址試試看能否解決
https://www.jianshu.com/p/c2e4eebf1183

0
nienst
iT邦新手 5 級 ‧ 2018-02-22 18:56:35

我剛剛遇到一個問題
有試過兩個指令,但還是一樣...
因為我目前用了兩支機器人,會切換目錄使用,不知道試不試切換時出了問題??

git remote add heroku https://git.heroku.com/nien-love-kamigo.git.
heroku git:remote -a nien-love-kamigo -r staging

C:\Users\Nien\Desktop\nien_love_kamigo\ironman>git push heroku master
Counting objects: 21, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (21/21), done.
Writing objects: 100% (21/21), 1.74 KiB | 890.00 KiB/s, done.
Total 21 (delta 16), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: ! The requested API endpoint was not found. Are you using the righ
t HTTP verb (i.e. GET vs. POST), and did you specify your intended version w
ith the Accept header?
remote:
To https://git.heroku.com/nien-love-kamigo.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/nien-love-kamigo.git'

nienst iT邦新手 5 級‧ 2018-02-22 20:22:47 檢舉

呃....
不知道為什麼 換來換去 忽然又正常了....
下次在遇到 我在試看看 為何出問題 以及 為何解決了

XD 幫不上忙

nienst iT邦新手 5 級‧ 2018-02-22 22:30:45 檢舉

呵呵 剛剛又出現一段錯誤訊息
我翻譯之後,更確定是因為我一直切換兩個程式 才會這樣

! git中的多個應用程序
! 用法: - 遠程分段
! 或者:--appnien-love-kamigo
! 您的本地git存儲庫在git remotes中引用了多個應用程序。
! 因此,我們無法確定您想要運行此命令的應用程序

! 反對。
! 使用--app或--remote指定所需的應用程序。
! Heroku在回購中遙控器:
! nien-love-kamigo(heroku)
! nien-love-kamigo(舞台)

https://devcenter.heroku.com/articles/multiple-environments

0
swda263041
iT邦新手 5 級 ‧ 2018-03-12 15:06:54

請問一下 除了用Heroku部屬以外
能自己透過server架設web server做到Heroku提供的功能嗎?

可以花很多錢,寫很多code之後達成跟 Heroku 一樣,但那就等於蓋一個 Heroku。

如果你是說能不能自己架 web server,就不用花很多錢,寫很多 code,學一下關於防火牆的設定應該就可以了。

Heroku 上面有的功能非常多,自架 server 要做到跟他一樣太難。

0
kenneth8701
iT邦新手 5 級 ‧ 2018-04-11 01:57:54

請問在 git add . 的時候出現
error: open("AppData/Local/Autodesk/Autodesk Desktop App/BrowserCache/GPUCache/data_0"): Permission denied
error: unable to index file AppData/Local/Autodesk/Autodesk Desktop App/BrowserCache/GPUCache/data_0
fatal: adding files failed
要怎麼解決呢?

看更多先前的回應...收起先前的回應...

請問你在哪裡輸入 git add .

照著您的步驟在 ironman

換git版本就解決了

請問你用哪個版本的 git 不順利

2.16.3

感謝回報

0
laapnda
iT邦新手 5 級 ‧ 2018-04-24 02:24:11

不好意思 請問我的git push heroku master輸入後會跳出這個窗格
https://ithelp.ithome.com.tw/upload/images/20180424/20109610SL4VPcw4Qw.jpg
然而不管輸入甚麼都會出現
https://ithelp.ithome.com.tw/upload/images/20180424/20109610j7R6Nplwu2.jpg
是輸入過程出了甚麼問題嗎

看更多先前的回應...收起先前的回應...
laapnda iT邦新手 5 級‧ 2018-04-26 00:41:02 檢舉

問題已解決,爬文後了解帳戶用信箱 密碼利用 heroku auth:token 去取得 不好意思打擾了

laapnda請問大大,我沒有跳出那個窗格,但是在輸入git push heroku master時會出現一樣的錯誤訊息,已經爬文卻找不到辦法,請問該如何解決?

卡卡米不好意思請問大大,要如何解決這個問題,沒有出現視窗讓我輸入,導致出現樓主CMD視窗中的錯誤訊息,麻煩您了。

參考這篇看看:https://devcenter.heroku.com/articles/authentication

因為你無法直接輸入帳密,所以應該就只能直接修改這個檔案內容: ~/.netrc

卡卡米已經閱讀文章,但文中似乎沒有提到如何修改~/.netrc檔案,不好意思又麻煩大大了。

如果你的電腦是 windows
在檔案總管的路徑列上面輸入 %HOMEPATH%
你就會到 ~ 資料夾,~ 代表的是這個使用者相關的資料夾

在 windows 的話,輸入 %HOMEPATH% 後按下 enter 後會看到 C:\Users\(你的使用者名稱)

所以如果你知道路徑的話你可以不用輸入 %HOMEPATH%
到了這個資料夾之後,找一個叫做 _netrc 的檔案,如果你找不到,就自己建立一個。

然後用 sublime text 去修改他的內容。

卡卡米感謝大大回復,那檔案要修改成怎樣,裡面目前是帳號(email)跟密碼(自己產生的一串key)。(PS:我修改後嘗試輸入git push heroku master後,_netrc檔案會被覆蓋,並產生另一組密碼)

疑 你那裡面有密碼了但還是不行?

卡卡米是的 輸入git push heroku master時,會出現樓主的錯誤訊息

雖然我覺得應該沒幫助,但你試試 heroku login 因為我也想不到其他方法

帳密輸錯一次就沒有補救方法了嗎

heroku login 可以重新進行吧

0
teemok
iT邦新手 5 級 ‧ 2018-06-07 18:01:43

請問卡米大大 若我的heroku 有兩個專案

git 時 要怎麼切換專案

他都只會 git 到其中一個 QQ

看更多先前的回應...收起先前的回應...

根據你下指令時所在的目錄 決定使用的專案

teemok iT邦新手 5 級‧ 2018-06-08 00:15:09 檢舉

https://ithelp.ithome.com.tw/upload/images/20180608/20110161F6rQiGIH5z.jpg](http://)

卡米大大 我要 git 到不同專案的時候 都會出現這訊息 網路上爬了很多文 試了很多指令 都沒辦法排除/images/emoticon/emoticon02.gif

你說的不同的專案是指什麼意思?

teemok iT邦新手 5 級‧ 2018-06-08 14:31:16 檢舉

git push heroku https://git.heroku.com/專案名.git

已自行解決XD 要先切換以上指令

完全無法理解你遇到什麼問題

teemok iT邦新手 5 級‧ 2018-06-08 17:02:33 檢舉

https://ithelp.ithome.com.tw/upload/images/20180608/20110161zChFek8Prg.png

哈哈...問題大概就是 如果我這頁面有兩個專案 做完第一個 要弄第二個時 git push master 時 就會發生問題(如先前回應所附的圖) 要打上面指令解決

你是說你有 2 個 heroku app,然後你只有一份 code 嗎?

teemok iT邦新手 5 級‧ 2018-06-08 18:28:12 檢舉

2 個 heroku app 2份code(資料夾)
1號做完 上傳 沒問題
切換到做2號資料夾 做完 上傳 會有問題

你的二號資料夾是複製一號資料夾來的 ?

teemok iT邦新手 5 級‧ 2018-06-10 15:19:52 檢舉

對OAO

git 的內容包含在資料夾中,所以當你複製資料夾的時候,你連對應的 heroku app server 網址也複製過去了 XD

teemok iT邦新手 5 級‧ 2018-06-13 23:46:05 檢舉

是阿XD 而且用兩台不同電腦開發時 上傳前還要多打指令 不然都不給傳 爬文已解決 感謝卡米大

0
freyr949487
iT邦新手 5 級 ‧ 2018-06-09 20:52:50

我的專案竟然不是在我的機器人位置!我的位置是
D:\貞德 (Alter)\ironman

0
ksml9207
iT邦新手 5 級 ‧ 2018-09-09 12:19:38

https://ithelp.ithome.com.tw/upload/images/20180909/201113109KzFDAPBV9.jpg
請問這是發生什麼事

我猜可能是在 heroku 初始設定階段沒做對

那麼該如何解決呢

重做一次 heroku 初始設定

0
stanly0726
iT邦新手 5 級 ‧ 2018-09-17 14:10:50

請問
我如果想在多台電腦上寫同一隻機器人
要怎麼操作呢(家裡電腦已經照您的文章操作,請問想新增的調鬧要怎麼操作?

如果你想要簡單的作法的話就用 Dropbox,你在每台電腦都裝,然後把專案資料夾放進 Dropbox 資料夾下,他會自動同步。

或者是學會用 git,git 是多人協作時的版本管理工具。
這是目前市面上寫最好的文件:為你自己學 Git
建議先把這整個看完再開始做機器人。

0
stanly0726
iT邦新手 5 級 ‧ 2018-09-18 19:45:22

上傳程式碼的部分,第二台電腦的操作跟原本一模一樣嗎(git init,heroku create之類的)

0
stanly0726
iT邦新手 5 級 ‧ 2018-09-18 19:45:23

上傳程式碼的部分,第二台電腦的操作跟原本一模一樣嗎(git init,heroku create之類的)

看更多先前的回應...收起先前的回應...

都有部分不一樣

請問我在第二台電腦遇到這問題,該怎麼解決?https://ithelp.ithome.com.tw/upload/images/20181024/20111762vDKvP5aMLB.jpg

我無法簡單的回答這個問題,但是如果你願意的話,這裡有份文件:
https://gitbook.tw/chapters/github/push-to-github.html

你從頭開始看,知道看懂我貼的這篇,你就會很清楚你要怎麼做了

謝謝大大,已經爬文知道問題了,git真神啊~
我現在在嘗試用sourcetree來上傳程式碼,圖形介面還是比較習慣

0
naughtyf
iT邦新手 5 級 ‧ 2018-10-09 15:50:01

https://ithelp.ithome.com.tw/upload/images/20181009/20112356cvKcrmpZzq.jpg
請問要怎麼解決

輸入 heroku login

我也是這個問題
輸入後 重新登入 也還是這樣

我要留言

立即登入留言