Config-help: Yarn dedupe fails when yarn is not globally installed

Created on 12 Feb 2020  路  2Comments  路  Source: renovatebot/config-help

What Renovate type are you using?

Self-hosted running on bamboo, upgrading a Bitbucket Server repo

Describe the bug

I added "postUpdateOptions": ["yarnDedupeFewer"] to my config which made my upgrades start failing because of yarn not being found (see debug logs).

Did you see anything helpful in debug logs?

build   11-Feb-2020 23:33:48     INFO: lock file error (repository=CONFCLOUD/confluence-frontend, branch=renovate/atlaskit-editor-upgrade)
build   11-Feb-2020 23:33:48           "cmd": "node /usr/lib/node_modules/renovate/node_modules/yarn/bin/yarn.js",
build   11-Feb-2020 23:33:48           "err": {
build   11-Feb-2020 23:33:48             "killed": false,
build   11-Feb-2020 23:33:48             "code": 127,
build   11-Feb-2020 23:33:48             "signal": null,
build   11-Feb-2020 23:33:48             "cmd": "npx [email protected] --strategy fewer && yarn",
build   11-Feb-2020 23:33:48             "stdout": "",
build   11-Feb-2020 23:33:48             "stderr": "npx: installed 4 in 1.236s\n/bin/sh: yarn: command not found\n",
build   11-Feb-2020 23:33:48             "message": "Command failed: npx [email protected] --strategy fewer && yarn\nnpx: installed 4 in 1.236s\n/bin/sh: yarn: command not found\n",
build   11-Feb-2020 23:33:48             "stack": "Error: Command failed: npx [email protected] --strategy fewer && yarn\nnpx: installed 4 in 1.236s\n/bin/sh: yarn: command not found\n\n    at ChildProcess.exithandler (child_process.js:295:12)\n    at ChildProcess.emit (events.js:223:5)\n    at ChildProcess.EventEmitter.emit (domain.js:475:20)\n    at maybeClose (internal/child_process.js:1021:16)\n    at Socket.<anonymous> (internal/child_process.js:430:11)\n    at Socket.emit (events.js:223:5)\n    at Socket.EventEmitter.emit (domain.js:475:20)\n    at Pipe.<anonymous> (net.js:664:12)"
build   11-Feb-2020 23:33:48           },
build   11-Feb-2020 23:33:48           "stdout": undefined,
build   11-Feb-2020 23:33:48           "stderr": undefined,
build   11-Feb-2020 23:33:48           "type": "yarn"

To Reproduce

Run renovate's yarn dedupe stage in a docker container that doesn't have yarn globally available. We use https://hub.docker.com/r/atlassian/bamboo-agent-base for running our upgrades, but any docker container without yarn globally installed would work

Additional context

Since the normal upgrade functionality itself works fine, I'm assuming renovate uses a locally installed yarn for that part of the cycle. I would expect de-duping to use the locally installed yarn as well. As not doing so could lead to inconsistencies when there's a mismatch between the yarn version used by renovate and the version available in the environment. Especially with all the changes in yarn 2.

Most helpful comment

@rarkins Awesome, I'll just add yarn to the docker container as it's the more future proof thing to do.

All 2 comments

npx is used to all yarn-deduplicate and it seems it depends on finding yarn in $PATH. You could work around that by adding your node_modules/.bin to the path before running renovate.

FYI we will be deprecating the "bundled" yarn and npm in a future major release so you will need to install your own binaries then anyway.

@rarkins Awesome, I'll just add yarn to the docker container as it's the more future proof thing to do.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Joge97 picture Joge97  路  6Comments

jugaltheshah picture jugaltheshah  路  4Comments

sjparkinson picture sjparkinson  路  5Comments

cowchimp picture cowchimp  路  4Comments

piotr-s-brainhub picture piotr-s-brainhub  路  7Comments