LoginSignup
1
1

More than 5 years have passed since last update.

CircleCI で yarn install が失敗したので対策を共有

Last updated at Posted at 2017-06-19

環境

  • CircleCI 1.0
  • yarn v0.21.3

手順通りに circle.yml を書いてみたところ

公式ドキュメント

yarn インストール失敗

そう簡単に行くことなく、yarn インストールが失敗。

$ yarn
yarn install v0.21.3
[1/4] Resolving packages...
⠁ [2/4] Fetching packages...
error laravel-mix@0.12.1: The engine "node" is incompatible with this module. Expected version ">=6.0.0".
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

node のバージョンをあげてみる

Node version: 4.2.6 でさすがに低すぎたので、
既に手元で動いていた 7.10.0 に上げてみる。

circle.yml
machine:
  node:
    version: 7.10.0
$ yarn
yarn install v0.21.3
[1/4] Resolving packages...
⠁ [2/4] Fetching packages...
warning fsevents@1.1.1: The platform "linux" is incompatible with this module.
info "fsevents@1.1.1" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "eslint-plugin-vue@2.0.1" has incorrect peer dependency "eslint@^2.0.0 || ^3.0.0".
warning "eslint-plugin-react@6.10.3" has incorrect peer dependency "eslint@^2.0.0 || ^3.0.0".
[4/4] Building fresh packages...
Done in 73.65s.

一部 warning が出てるけど成功した。

と思ったら PHPUnit が失敗

$ vendor/bin/phpunit
bash: line 1: vendor/bin/phpunit: No such file or directory
vendor/bin/phpunit returned exit code 127

コンテナに ssh してみたところ、 vender ディレクトリがそもそもなかった。
つまり、composer install されていなかったもよう。

それならと思い、明示的に composer install するように書いてみたら、無事に PHPUnit も実行されてビルドが成功した。

circle.yml
dependencies:
  override:
    - composer install --no-interaction

なぜ composer install されなくなったのかは不明だが、正常にビルドできたので一旦良しとする。

最終的な circle.yml

circle.yml
machine:
  php:
    version: 7.1.0
  node:
    version: 7.10.0
  environment:
    PATH: "${PATH}:${HOME}/${CIRCLE_PROJECT_REPONAME}/node_modules/.bin"

dependencies:
  override:
    - yarn
    - composer install --no-interaction
  cache_directories:
    - ~/.cache/yarn

test:
  override:
    - vendor/bin/phpunit
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1