パRails(2回目)
# 環境
- Ruby 2.7.6
- Rails 6.0.3
- node 16.17.0 (2022年8月時点 最新安定版)
自分のローカル環境に2.7.6
が入っているか確認する
$ rbenv versions
1で2.7.6
が入っていなければ、以下のコマンドでインストール
$ rbenv install 2.7.6
バージョン切り替え
$ rbenv local 2.7.6
Gemfileの書き換え
ダウンロードしたサンプルコードのGemfileには元々、
# Gemfile
ruby '2.6.6'
と記載されているため、2.7.6に書き換える。
# Gemfile
ruby '2.7.6'
2.7.6
を使うことに決めました自分の環境に入っているバージョンの確認
$ gem list rails
インストール
$ gem i -v 6.0.3 rails
bundle install
すると、mimemagic
のエラーが出るbundle install
すると以下のエラーが出るInstalling dependencies using bundler 2.2.1
Running: bundle install --jobs=4 --retry=4
Your bundle is locked to mimemagic (0.3.5), but that version could not be found
in any of the sources listed in your Gemfile. If you haven't changed sources,
that means the author of mimemagic (0.3.5) has removed it. You'll need to update
your bundle to a version other than mimemagic (0.3.5) that hasn't been removed
in order to install.
minemagic
というgemが、ライセンスを変えたことが原因で、Railsがbuildできなくなっている (参考:RailsのGPL混入問題についてまとめ(mimemagic) - Qiita)bundle update
する ←パRails輪読会ではこちらを選択しましたrails s
したら、Yarnのエラーが出る========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).
yarn install --check-files
を実行するrails s
してみてもダメな場合、以下を実行するconfig/webpacker.yml
を開き、check_yarn_integrity
2ヶ所をfalse
に書き換えるdefault: &default
source_path: app/javascript
source_entry_path: packs
public_root_path: public
public_output_path: packs
cache_path: tmp/cache/webpacker
check_yarn_integrity: false #ここをfalseにする
webpack_compile_output: true
(...省略...)
development:
<<: *default
compile: true
# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
check_yarn_integrity: false #ここをfalseにする
rails s
したら起動できる$ git clone https://github.com/Paru871/book_admin.git
$ bundle
$ yarn
$ bin/setup
$ rails db:reset
rails s
してRailsを起動する。$ git pull origin main
「JavaScript環境の設定」プラクティスでは上記ファイルに対応する設定の指示が今年に入ってから更新されていますので、.nvmrcの設定ができている方は特に何もしなくてOKです。
昨年までに「JavaScript環境の設定」プラクティスが修了している方は下記のリンクから.nvmrcの対応をお願いします。
nodeのバージョン切り替え · fjordllc/bootcamp Wiki
$ nvm ls
$ nvm install 12.22.12
FROM elasticsearch:7.17.4
RUN elasticsearch-plugin install analysis-kuromoji
services:
elasticsearch:
build: .
environment:
discovery.type: single-node
ports:
- "9200:9200"
- "9300:9300"
Docker Desktopをインストール
Docker Desktop の Mac へのインストール | Docker ドキュメント
ターミナル上で、以下を実行(Docker Desktopではやらない)
$ docker compose build
$ docker compose up
docker compose up
でelasticsearch
が起動するので、起動したままの状態でrails s
する。or
or
By clicking below, you agree to our terms of service.
New to HackMD? Sign up
Syntax | Example | Reference | |
---|---|---|---|
# Header | Header | 基本排版 | |
- Unordered List |
|
||
1. Ordered List |
|
||
- [ ] Todo List |
|
||
> Blockquote | Blockquote |
||
**Bold font** | Bold font | ||
*Italics font* | Italics font | ||
~~Strikethrough~~ | |||
19^th^ | 19th | ||
H~2~O | H2O | ||
++Inserted text++ | Inserted text | ||
==Marked text== | Marked text | ||
[link text](https:// "title") | Link | ||
 | Image | ||
`Code` | Code |
在筆記中貼入程式碼 | |
```javascript var i = 0; ``` |
|
||
:smile: | ![]() |
Emoji list | |
{%youtube youtube_id %} | Externals | ||
$L^aT_eX$ | LaTeX | ||
:::info This is a alert area. ::: |
This is a alert area. |
On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?
Please give us some advice and help us improve HackMD.
Do you want to remove this version name and description?
Syncing