Bug description
Command
yarn run something
What is the current behavior?
something
is executed with an environment that has random folders prepended to PATH. The prepending happens here:
yarn/src/util/execute-lifecycle-script.js
Lines 175 to 237
in
a4708b2
The worst offender being
yarn/src/util/execute-lifecycle-script.js
Line 188
in
a4708b2
This can potentially cause wrong programs to be executed if there are multiple versions installed, with no way to configure this behaviour.
What is the expected behavior?
Run commands with unmodified environment, or make overriding behaviour configurable
Steps to Reproduce
mkdir -p /tmp/a
cat > /tmp/a/package.json <<EOF
{
"scripts": {
"something": "echo \$PATH"
}
}
EOF
echo "$PATH"
(cd /tmp/a && yarn run something) # != PATH
Environment
- Node Version: v12.15.0
- Yarn v1 Version: 1.22
- OS and version: arch linux kernel 5.9.10-arch1-1
That’s an artifact of the past and no longer done in v2
https://yarnpkg.com/getting-started/migration