らいふうっどの閑話休題

興味のあることをゆる~く書いていく

wercker ビルドが失敗したときの対処法 / What to do if wercker build fails

wercker ビルドが失敗したときの対処法 / What to do if wercker build fails

f:id:ic_lifewood:20201108031332p:plain

ポートフォリオサイトを更新した時に wercker ビルドが失敗した
Wercker build failed when updating portfolio site

f:id:ic_lifewood:20201108031625p:plain

リトライしてもエラーが出るので何か問題があるようだ
I get an error even if I try again, so there seems to be something wrong

エラー内容 / error contents

export WERCKER_STEP_ROOT="/pipeline/npm-install-3d94c7fd-6bb5-41ce-ba4a-d261874f7e8d"
export WERCKER_STEP_ID="npm-install-3d94c7fd-6bb5-41ce-ba4a-d261874f7e8d"
export WERCKER_STEP_OWNER="wercker"
export WERCKER_STEP_NAME="npm-install"
export WERCKER_REPORT_NUMBERS_FILE="/report/npm-install-3d94c7fd-6bb5-41ce-ba4a-d261874f7e8d/numbers.ini"
export WERCKER_REPORT_MESSAGE_FILE="/report/npm-install-3d94c7fd-6bb5-41ce-ba4a-d261874f7e8d/message.txt"
export WERCKER_REPORT_ARTIFACTS_DIR="/report/npm-install-3d94c7fd-6bb5-41ce-ba4a-d261874f7e8d/artifacts"
export WERCKER_NPM_INSTALL_CLEAR_CACHE_ON_FAILED="true"
export WERCKER_NPM_INSTALL_USE_CACHE="true"
export WERCKER_NPM_INSTALL_OPTIONS=""
source "/pipeline/npm-install-3d94c7fd-6bb5-41ce-ba4a-d261874f7e8d/run.sh" < /dev/null
Using wercker cache
Creating $WERCKER_CACHE_DIR/wercker/npm
Configuring npm to use wercker cache
Starting npm install, try: 1
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: portfolio@0.0.0
npm ERR! Found: @angular/common@11.0.0-rc.2
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^11.0.0-rc.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^9.0.0 || ^10.0.0" from @angular/fire@6.0.4
npm ERR! node_modules/@angular/fire
npm ERR!   @angular/fire@"^6.0.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /pipeline/cache/wercker/npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /pipeline/cache/wercker/npm/_logs/2020-11-07T17_16_18_612Z-debug.log
Clearing npm cache
npm ERR! As of npm@5, the npm cache self-heals from corruption issues
npm ERR! by treating integrity mismatches as cache misses.  As a result,
npm ERR! data extracted from the cache is guaranteed to be valid.  If you
npm ERR! want to make sure everything is consistent, use `npm cache verify`
npm ERR! instead.  Deleting the cache can only make npm go slower, and is
npm ERR! not likely to correct any problems you may be encountering!
npm ERR! 
npm ERR! On the other hand, if you're debugging an issue with the installer,
npm ERR! or race conditions that depend on the timing of writing to an empty
npm ERR! cache, you can use `npm install --cache /tmp/empty-cache` to use a
npm ERR! temporary cache instead of nuking the actual one.
npm ERR! 
npm ERR! If you're sure you want to delete the entire cache, rerun this command
npm ERR! with --force.

npm ERR! A complete log of this run can be found in:
npm ERR!     /pipeline/cache/wercker/npm/_logs/2020-11-07T17_16_20_630Z-debug.log
Creating $WERCKER_CACHE_DIR/wercker/npm
Starting npm install, try: 2
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: portfolio@0.0.0
npm ERR! Found: @angular/common@11.0.0-rc.2
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^11.0.0-rc.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^9.0.0 || ^10.0.0" from @angular/fire@6.0.4
npm ERR! node_modules/@angular/fire
npm ERR!   @angular/fire@"^6.0.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /pipeline/cache/wercker/npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /pipeline/cache/wercker/npm/_logs/2020-11-07T17_16_21_905Z-debug.log
Clearing npm cache
npm ERR! As of npm@5, the npm cache self-heals from corruption issues
npm ERR! by treating integrity mismatches as cache misses.  As a result,
npm ERR! data extracted from the cache is guaranteed to be valid.  If you
npm ERR! want to make sure everything is consistent, use `npm cache verify`
npm ERR! instead.  Deleting the cache can only make npm go slower, and is
npm ERR! not likely to correct any problems you may be encountering!
npm ERR! 
npm ERR! On the other hand, if you're debugging an issue with the installer,
npm ERR! or race conditions that depend on the timing of writing to an empty
npm ERR! cache, you can use `npm install --cache /tmp/empty-cache` to use a
npm ERR! temporary cache instead of nuking the actual one.
npm ERR! 
npm ERR! If you're sure you want to delete the entire cache, rerun this command
npm ERR! with --force.

npm ERR! A complete log of this run can be found in:
npm ERR!     /pipeline/cache/wercker/npm/_logs/2020-11-07T17_16_22_551Z-debug.log
Creating $WERCKER_CACHE_DIR/wercker/npm
Starting npm install, try: 3
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: portfolio@0.0.0
npm ERR! Found: @angular/common@11.0.0-rc.2
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^11.0.0-rc.2" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^9.0.0 || ^10.0.0" from @angular/fire@6.0.4
npm ERR! node_modules/@angular/fire
npm ERR!   @angular/fire@"^6.0.2" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /pipeline/cache/wercker/npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /pipeline/cache/wercker/npm/_logs/2020-11-07T17_16_23_798Z-debug.log
Clearing npm cache
npm ERR! As of npm@5, the npm cache self-heals from corruption issues
npm ERR! by treating integrity mismatches as cache misses.  As a result,
npm ERR! data extracted from the cache is guaranteed to be valid.  If you
npm ERR! want to make sure everything is consistent, use `npm cache verify`
npm ERR! instead.  Deleting the cache can only make npm go slower, and is
npm ERR! not likely to correct any problems you may be encountering!
npm ERR! 
npm ERR! On the other hand, if you're debugging an issue with the installer,
npm ERR! or race conditions that depend on the timing of writing to an empty
npm ERR! cache, you can use `npm install --cache /tmp/empty-cache` to use a
npm ERR! temporary cache instead of nuking the actual one.
npm ERR! 
npm ERR! If you're sure you want to delete the entire cache, rerun this command
npm ERR! with --force.

npm ERR! A complete log of this run can be found in:
npm ERR!     /pipeline/cache/wercker/npm/_logs/2020-11-07T17_16_24_253Z-debug.log
Creating $WERCKER_CACHE_DIR/wercker/npm
failed: Failed to successfully execute npm install, retries: 3

npm install で、エラーになっている事が分かる
npm install shows that there is an error

解決方法 / Solutions

werckerで実行される時のバージョンを開発環境と合わせる
Match the version when executed by wercker with the development environment

f:id:ic_lifewood:20201108032228p:plain

開発環境の node のバージョンを v10.15.1 =>v12.9.0 に上げた事で、wercker 環境で、npm が実行出来ない環境になったのが原因のようだ。
By raising the version of node in the development environment to v10.15.1 => v12.18.2, it seems that the cause is that npm cannot be executed in the wercker environment.

プッシュして、CI を再実行したら、パスした。
I pushed and re-run CI and it passed.

f:id:ic_lifewood:20201108032941p:plain

参考 / reference

参考になったブログは、ここ数年ご無沙汰している知人のブログだった!
The blog that served as a reference was the blog of an acquaintance I haven't seen in the last few years!

@mitsuruog さん、有難うございました!
Thank you, @mitsuruog!

blog.mitsuruog.info