事象
突然CircleCI上でテストがコケるようになりました。
調べてみるとwebpackerがフックしているassets:precompile
で失敗している様子。。
# !/bin/bash -eo pipefail
bundle exec rake assets:precompile
/home/circleci/my_project/vendor/bundle/ruby/2.5.0/bin/rake: No such file or directory - yarn
Yarn not installed. Please download and install Yarn from https://yarnpkg.com/lang/en/docs/install/
Exited with code 1
- assets:precompileをフックしてwebpacker:compileが実行される
- webpacker:compile内でyarnが実行される
- yarnないよ!って怒られる
今まで何も言わないいい子だったのにどうして突然・・・
原因
CircleCIコミュニティにも報告が上がってました。
Yarn missing from latest node 8 images? - Bug Reports - CircleCI Community Discussion
yarnのパスが通ってないバグがあったようです。(すでにmerge済)
Fixed symbolic links to yarn and yarnpkg by cecton · Pull Request #650 · nodejs/docker-node
解決
とりあえずyarnが実行できるようにPATHを追加してあげればOK。
PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
もしくは
- run: PATH=$PATH:/opt/yarn/yarn-v1.5.1/bin
これ、CircleCIのキャッシュの運次第らしい
(dockerイメージは circleci/ruby:2.5.0-node-browsers
を使ってました)
最近のNode.js公式Dockerイメージでyarnのパスが通ってないバグ。最新では直ってるけどCircleCIのキャッシュガチャで当たると落ちる
http://b.hatena.ne.jp/entry/360606178/comment/teppeis
てんやわんやでしたー。
以上。