【Docker / Gatsby】Alpine で gatsby new をしたところPythonが入ってないことでエラーになる
もうタイトルのまんま。
前提
- docker(docker-compose)使用
- OSは
node:18-alpine
- Dockerfileは以下の通り
FROM node:18-alpine RUN apk add --no-cache git ...
エラーについて
コンテナ作成後、コンテナに入り gatsby new . [repo url]
を実行
しばらくしたら
npm ERR! code 1 npm ERR! path /node_modules/lmdb npm ERR! command failed npm ERR! command sh -c node-gyp-build-optional-packages npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using node-gyp@9.0.0 npm ERR! gyp info using node@18.3.0 | linux | x64 npm ERR! gyp ERR! find Python npm ERR! gyp ERR! find Python Python is not set from command line or npm configuration npm ERR! gyp ERR! find Python Python is not set from environment variable PYTHON npm ERR! gyp ERR! find Python checking if "python3" can be used npm ERR! gyp ERR! find Python - "python3" is not in PATH or produced an error npm ERR! gyp ERR! find Python checking if "python" can be used npm ERR! gyp ERR! find Python - "python" is not in PATH or produced an error npm ERR! gyp ERR! find Python npm ERR! gyp ERR! find Python ********************************************************** npm ERR! gyp ERR! find Python You need to install the latest version of Python. npm ERR! gyp ERR! find Python Node-gyp should be able to find and use Python. If not, npm ERR! gyp ERR! find Python you can try one of the following options: npm ERR! gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable" npm ERR! gyp ERR! find Python (accepted by both node-gyp and npm) npm ERR! gyp ERR! find Python - Set the environment variable PYTHON npm ERR! gyp ERR! find Python - Set the npm configuration variable python: npm ERR! gyp ERR! find Python npm config set python "/path/to/pythonexecutable" npm ERR! gyp ERR! find Python For more information consult the documentation at: npm ERR! gyp ERR! find Python https://github.com/nodejs/node-gyp#installation npm ERR! gyp ERR! find Python ********************************************************** npm ERR! gyp ERR! find Python npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: Could not find any Python installation to use npm ERR! gyp ERR! stack at PythonFinder.fail (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:330:47) npm ERR! gyp ERR! stack at PythonFinder.runChecks (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:159:21) npm ERR! gyp ERR! stack at PythonFinder.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:202:16) npm ERR! gyp ERR! stack at PythonFinder.execFileCallback (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/find-python.js:294:16) npm ERR! gyp ERR! stack at exithandler (node:child_process:395:5) npm ERR! gyp ERR! stack at ChildProcess.errorhandler (node:child_process:407:5) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:527:28) npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:289:12) npm ERR! gyp ERR! stack at onErrorNT (node:internal/child_process:476:16) npm ERR! gyp ERR! stack at process.processTicksAndRejections (node:internal/process/task_queues:82:21) npm ERR! gyp ERR! System Linux 4.19.76-linuxkit npm ERR! gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /node_modules/lmdb npm ERR! gyp ERR! node -v v18.3.0 npm ERR! gyp ERR! node-gyp -v v9.0.0 npm ERR! gyp ERR! not ok npm ERR! A complete log of this run can be found in: ERROR Command failed with exit code 1: npm install
よく見てみるとPythonがないことで処理ができずにエラーになっているっぽい。
てかPython使うんか。
解決方法は Dockerfile
に以下を追記し、docker-compose up -d --build
でコンテナ再作成。
FROM node:18-alpine RUN apk add --no-cache git # 追記 RUN apk add --update python3 make g++\ && rm -rf /var/cache/apk/* ...
再作成後に改めてコンテナに入り gatsby new . [repo url]
を実行するとエラーが出ずに処理が終了する
参考サイト
【Docker】Alpineにてホスト名が解決できない(Could not resolve host)ときにやること
Gatsby用にDocker環境を作り、 gatsby new
したところ git clone
でエラーが。
エラーメッセージ見ても解決できそうになかったので自分で git clone
をしたところ
fatal: unable to access 'https://github.com/........': Could not resolve host: github.com
github.com
の名前解決ができないらしい。
docker-compose
を使っている場合は docker-compose.yml
に
services: .... dns: - 8.8.8.8
とDNSに関する情報を追加し docker-compose up -d --build
でコンテナを再構築すると解決できる。
参考サイト
【コーヒー】粕谷哲さん 4:6メソッドのメモ
最近改めてコーヒーのドリップの勉強をしてる。 Youtubeで粕谷哲さん本人が4:6メソッドについて詳しく説明している動画があったので自分用にメモをまとめてみた。
動画は↓より。 【教科書】世界を獲った伝説のコーヒードリップレシピ🏆4:6メソッドの全てをお伝えします! - YouTube
以下自分用メモ
4:6メソッドとは
「知識があれば誰でも簡単に美味しいコーヒーが入れられる」ためのメソッドである
ざっくりいうと
- 湯量の40%で味の方向性を決めて
- 湯量の60%でコーヒーの濃度を決める
というコーヒーの淹れ方。 技術も大事だけど再現性を重視したやり方。
湯量について
お湯の量は「使う粉の量 * 3 * 5」
コーヒー豆が20gだったら60gのお湯を5回に分けて落とすくらいの量とする
お湯の温度について
浅煎りは温度高め(93℃くらい)、深入りは温度低め(83℃くらい)
中煎りはその中間(88℃くらい)
最初の40%について
味の方向性がここで決まる。
1投目のお湯の量が少なめだったら「甘さ」が強調される。
逆に多めだったら「酸味」が強調される。
残りの60%について
濃度を決める。濃度はお湯の投入回数で決定される。
3回(お湯の量は等分)で淹れると濃く、2回、1回になるにつれて薄くなっていく
お湯の注ぎ方について
お湯は「全体にかける」
コーヒーの粉のドーム云々は考えない。
フィルターの際にかけないのが良しと一般には言われるがあまり関係なくかける。
1回淹れたお湯が落ちきってから次の1投を淹れる。
豆の細かさについて
中〜粗挽きくらい。
3分30秒で抽出が完了するくらいが目安。
抽出が早いと豆が粗いし、遅いと細かすぎるので次回は調整する。
1投あたり45秒くらい?
【AWS】 EC2でNode.jsが使えるようにする
AWSでEC2を立てた後、Node.jsが使えるようにセットアップを実施する。
AWSのチュートリアルに沿えば簡単にできる。
実施した環境は以下の通り。
前提
対応内容
- SSHでEC2にログインする
nvm(ノードバージョンマネージャー)
をインストールする$ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
インストールした
nvm
を有効化する$ . ~/.nvm/nvm.sh
nvm
を利用してNode.js
をインストールする$ nvm install node
Node.js
がインストールされたかバージョンを表示して確認する$ node -v v18.3.0 $ npm -v 8.11.0
参考サイト
クレバーコーヒードリッパーでアイスコーヒー
以前からずっと欲しかったクレバーコーヒードリッパーをついに買ってしまった。Lサイズ。見た目的にはHARIOのSwitchが好みだったけど値段が高かったのとHARIOのドリッパーは既に持っているからこっちにした。
レシピはネットで見つけた以下レシピを参考にした。
クレバーを使用したおいしい急冷式アイスコーヒーの作り方 〜中深煎り編〜 – Coffee Wrights Blog
- フィルターにお湯をかけてリンス
- 豆を36gセットし95℃のお湯を75ml注ぎ撹拌
- 30秒経ったら150mlお湯を投入(全体で225mlになる)
- お湯をいれ始めて2分になったらサーバに氷を入れてサーバに乗せてコーヒーを落とす
ちなみに豆はAmazonで買った「TAIVAS COFFEE」のブラジル。酸味は少なくバランスが良い味。
飲んでみたところ、スッキリして甘みが強いアイスコーヒーになった。個人的にはもう少し苦味があるほうが好きなので思うのでお湯に浸す時間を長くして試してみたい
Xiaomi mi watchのバンドを革製のものに変えた
cores コーングラインダー C330の粉受けにDAISOのガラスキャニスターが良かった
coresのコーングラインダー、少し前に買っていて電動でコーヒーが挽けることに毎回感動してるんだけど、粉受けが静電気で粉だらけになるのがちょっと気になって……。
粉受けがプラスチックなので帯電しやすいのかと思いビーカーなどガラス製の入れ物を探していたところ、DAISOに売っているガラスキャニスターが良さそうだったので購入。
高さはコーヒー豆の排出口とほぼ同じなのでこぼれることなく受けることが出来ていい感じ。
静電気によるストレスが安く解決できて良かった。